When I submitted my talk proposals to iOSDevUK, I also suggested my talk Building Reusable SwiftUI Components. It's a really good talk (I have been told) that walks through the process of refactoring a moderately complex
List based UI into a reusable
Avatar component that supports SwiftUI's styling API.
But the organisers, always on the look out to make iOSDevUK the best iOS/Swift conference, suggested running the talk as a workshop.
So I sat down and turned the talk into an interactive tutorial (using DocC). It's divided into four chapters that walk you through
- Basic and more advanced techniques for composing views
- How to make SwiftUI views customisable
- Making your views interactive by adding action handlers
- Using SwiftUI's styling API to make them stylable, just like the built-in views like
You can finish the tutorial in under 2.5 hours, and I promise it will take your understanding of SwiftUI to the next level.
I've even been told that you do the entire tutorial just on an iPad using Swift Playgrounds, which is pretty mind blowing.
I hope you like the tutorial - if you finish, let me know what you thought about it. Or, even better, tweet about it, so other people can benefit, too.
Documentation for creating iOS Share Extensions has been scarce: Apple's original documentation hasn't been updated since 2017 (and obviously doesn't show how to integrate with SwiftUI), and the only other articles I was able to find are this one from 2020 (no SwiftUI, though), and this one from 2021.
Henri wrote an excellent article about how to Create an iOS Share Extension with custom UI in Swift and SwiftUI, and it answers all the questions you might have:
- How to add a Share Extension target to your project
- How Activation Rules work
- How to show your own UI (in SwiftUI)
- Accessing the shared data
- And how to close your SwiftUI view (this is surprisingly hard!)
Great work, and i f you want to see this in action, you should check out Henri's app Thoughts (an Inspiration Manager)!