Hey iOS developer! 👋
I’ve noticed that we often put a lot of effort into user interaction features—focusing on how long users spend in the app—while sometimes overlooking the importance of engagement, like making it easy for users to share specific data or content into your app.
This week’s topic for Curated iOS is all about creating a Share Extension. I’ve gathered a selection of useful articles from various sources to help you implement it effectively.
In the apps I've worked on, we didn't have the need to implement a Share extension, so I didn’t have hands-on experience with it. To find a practical example, I explored my device and came across a great use case with the Substack app. Here, I'm using the Share extension to publish a note that includes a link to my Curated iOS newsletter. It's a powerful feature that enhances user experience by streamlining content sharing.
Now, let's dive into what the Share extension is all about and explore its potential for enhancing app functionality.
Creating a Custom Share Extension Bottom Sheet for iOS: Inspired by Telegram
What I love about this article by Yana Sychevska is that, in addition to providing a code example for implementing a Share extension, she also walks you through customizing the UI using SwiftUI, making it resemble the well-known Telegram app. Plus, she demonstrates how to use the new SwiftData framework from Apple for storing the received data.
Read on Medium
Understand and implement Share Extension Conversation Suggestions in Swift for iOS
I found some great tips in this article by Aakash Shrestha on adding Conversation suggestions. Essentially, Conversation suggestions present a list of suggested recipients for sharing, and I find this feature very convenient. The author’s suggestion to test the implementation on a real device instead of using the Simulator is something I found applicable to all development work. I’ve encountered several times where the Simulator doesn’t behave exactly like a real device.
Read on Medium
Supporting suggestions in your app’s share extension
In addition to the previous article, I suggest taking a look at the official Developer documentation on supporting suggestions.
Read on Apple Developer
Share Extension with Apple/Google Maps in SwiftUI
This article by Marwa Diab is not just a tutorial on sharing a location from Apple and Google Maps to your app extension. It’s also a great walkthrough on using App Groups to access a shared container between your app and the app extension.
Read on Medium
Setting up your AppGroup to share data between App & Extensions in iOS
I love articles where the author shares implementation details based on their own project code. This is one of those articles, where John Baker teaches how to set up an App Group to share UserDefaults and local storage between his step counter app and its extension.
Read on Medium
I couldn’t help but add a few materials on implementing the opposite sharing flow—sharing data from your app. For this, you can use either ShareLink for SwiftUI code or UIActivityViewController for UIKit.
SwiftUI ShareLink – Display a Share Sheet
This is a highly detailed tutorial, full of code snippets and explanations, which I find more appropriate for beginner iOS developers. However, more experienced developers might also find it useful.
Read on Code With Chris
ShareLink and ShareSheet in iOS 16
If you prefer watching a tutorial rather than reading one, then this video by Stewart Lynch is for you. It starts with the basics of sharing data via text message or email and also covers more practical examples.
Watch on YouTube
Sharing data with UIActivityViewController - tips & tricks
Finally, in his article Filip Němeček goes beyond the basic UIActivityViewController implementation, by create sharing metadata by hand. I find it very informative, and clearly can help you expand your content sharing implementation in UIKit.
Read Filip Němeček's Blog
I hope you enjoyed this issue, so don’t forget to hit the Like button and subscribe if you haven’t already!
Stay tuned for more in the upcoming issues. Until next time!
Artjoms