SwiftUI

learn Apple’s SwiftUI.

How to change text size in an iOS Simulator?

Xcode 14 onwardsSimulator ► Accessibility ► Display & Text Size ► Larger Text ► Select Font. Simulator ► Accessibility ► Display & Text Size ► Larger Text ► Select Font. If you wish to chose font for SwiftUI Preview Select device setting from bottom preview tab.You can see live font changes from SwiftUI code.

How to set two line text in SwiftUI ?

For setting up n number of lines of Text in swiftUI we can use .lineLimit(.. function which takes arguments as number of lines. #For iOS 15 & Below : we have to set .fixedSize(horizontal: false, vertical: true) & .lineLimit(2) # For iOS 16 onwards

How to Change NavigationView Colour in SwiftUI

iOS 16 From iOS 16 we can use .toolbarBackground for the NavigationBar / NavigationView Color. Don’t forget to add .toolbarBackground(.visible, for: .navigationBar). You can also set title color of Navigation Item by using ToolbarItem iOS 13 Solution By setting up the UINavigationBarAppearance we can change the Navigation bar Color. But remember it will affect globally.

VStack fill the width of the screen in SwiftUI

Generally when we use VStack with few views we observed that there is some empty place left over we will see two possible ways- 1. By using frame 2. Use GeometryReader with frames GeometryReader returns a flexible preferred size to its parent layout hence by using arguments geoArgs we can set frame –