Skip to content

Instantly share code, notes, and snippets.

View dziobaczy's full-sized avatar
🤔
t h o n k i n g

Piotr Szadkowski dziobaczy

🤔
t h o n k i n g
View GitHub Profile
@dziobaczy
dziobaczy / SwiftUI-in-UIKit-app.swift
Last active February 7, 2022 09:30
This gist shows idea behind adding SwiftUI to the UIKit app in a clean way that allows easy fallback to UIKit if needed. Please save that file with `playground` and open in Xcode so that you can benefit from documentation rendering for better reading experience!
/*:
# SwiftUI Views in UIKit World
(If you see this as a comment instead rendering, open the pane on the right and select `Render Documentation` in `Playground Settings`)
This is a simple concept of how you can use SwiftUI for creating your views, at the
same time protecting your app from having SwiftUI everywhere.
Imagine you use coordinators in your app and inject into them view controller factories. This way you can easily compose and test your app. Now for the new feature you would like to try SwiftUI. What can you do?
*/