Archives

  • Customizing Navigation Bar Appreance using SwiftUI

    If you are having trouble trying to customize the navigation appearance like I have been. You can use the following code, I have been placing my code in its own function and calling from the delegate function application(application:launchOptions:). func customNavigationAppearance() { let appearance = UINavigationBarAppearance() appearance.configureWithOpaqueBackground() appearance.backgroundColor = .black appearance.titleTextAttributes = [ .foregroundColor: UIColor.white ] […]

    Jun 11th, 2020 • Filed under Apple, iOS, SwiftUIPrint View
  • Reduce Array to String for Text and Other Views

    If you ever need to concatenate an array of strings for formatting in SwiftUI view, you can use the reduce() function, like this: let words = [“Hello”, “World”] var body: some View { words.reduce(Text(“”), { $0 + Text($1) + Text(” “)} ) } } $0 = First parameter of reduce function$1 = Reduce string

    Jun 9th, 2020 • Filed under Apple, iOS, SwiftUIPrint View
  • Extending iOS 13 UIColor

    iOS 13 comes with a new color scheme, and to access the old system colors, you will need to reach for UIColor and maybe create a Color object, like so: let ourColor = Color(UIColor.systemGray5) Extending the UIColor class is made easy by switch extension. extension UIColor { var asColor: Color { return Color(self) } } […]

    Jun 2nd, 2020 • Filed under Apple, iOS, Swift, SwiftUIPrint View
Archive for the ‘SwiftUI’ Category