ylliX - Online Advertising Network

Rendering SwiftUI views within UITableView or UICollectionView cells on iOS 16 | Swift by Sundell

Ever since its original introduction in 2019, SwiftUI has had really strong interoperability with UIKit. Both UIView and UIViewController instances can be wrapped to become fully SwiftUI-compatible, and UIHostingController lets us render any SwiftUI view within a UIKit-based view controller. However, even though macOS has had an NSHostingView for inlining SwiftUI views directly within any […]

Currency TextField in SwiftUI

Between banking and crypto apps, it’s quite often we interact with currency inputs on daily basis. If creating a localized UITextField can already be tricky in UIKit, I was wondering how hard it would be to do a similar one in SwiftUI. Let’s see today how to create a localized currency TextField in SwiftUI. This […]

Previewing SwiftUI views in landscape | Swift by Sundell

Starting in Xcode 13, SwiftUI views can now be previewed in landscape orientation using the new previewInterfaceOrientation modifier. For example, here we’re previewing a MenuView in both portrait and landscape by creating two instances of our view within its PreviewProvider: struct MenuView_Previews: PreviewProvider { static var previews: some View { MenuView() MenuView().previewInterfaceOrientation(.landscapeRight) } } Note […]