Posts

Showing posts with the label codingpills

SwiftUI: Custom navigation

Image
SwiftUI Custom navigation component motivation: Building a custom navigation component for SwiftUI is a useful addition to SwiftUI community. After the release of SwiftUI, until now (beta 5 of xcode 11), one of the pain points experienced by the Swift developer was the customisation of the navigation bar. Precisely, changing the colour of the bar, the colour or font of the text, the look of the back button seem to be impossible or quite cumbersome tasks. Also navigating programatically is something that you cannot do with the out-of-the-box API provided by Apple. I have seen solutions involving changing the global appearance of the navigation bar: UINavigationBar.appearance().backgroundColor = .green or solutions trying to open the destination of the navigation as modal; however none of those solutions are entirely satisfying my needs while developing an app. They feel like workarounds, rather than fully trustable solutions Therefore, I was thinking about a custom mad...