Post

Replies

Boosts

Views

Activity

Reply to iOS 14 & SwiftUI: how to customize back button's image?
Try using: .navigationBarItems(leading: { 		Button(action: { 				print(">>>>tapped!!!!!") 		}) { 				HStack { 						Image(systemName: "arrow.2.circlepath") 								.imageScale(.large) 						Text("Button") 				} 		} }) You can replace the HStack with a VStack. Or get fancy and try the new Label with both text and image. See https://developer.apple.com/documentation/swiftui/navigationview/navigationbaritems(leading:) for more details. Also. navigationBarItems and some other navigation bar functions don't exist for macOS.
Jul ’20
Reply to SwiftUI - Determining Current Device and Orientation
You can check for portrait/landscape like this: GeometryReader { geometry in 	 if geometry.size.height > geometry.size.width { 			print("portrait") 	 } else { 			print("landscape") 	 } That won't tell you what device you are on. But, that will work if you want to handle wide windows differently from tall windows on an iPad, too. (Or probably on macOS, too. I haven't tested that, though. That's an exercise left for the reader.)
Jun ’20