Post

Replies

Boosts

Views

Activity

SwiftUI sheet gets dismissed the first time it is presented
Sometimes (well most of the time) presented sheet gets dismissed first time it is opened. This is happening only on a device and only the first time the app is launched. This is the code: struct ContentView: View { 	 		var body: some View { 			 				NavigationView { 						NavigationLink(destination: DetailsView()) { 								Text("Open Details View") 						} 				} 				.navigationViewStyle(StackNavigationViewStyle()) 		} } struct DetailsView: View { 	 		@State var sheetIsPresented: Bool = false 	 		var body: some View { 				VStack { 						Button("Open") { 								sheetIsPresented.toggle() 						} 				}.sheet(isPresented: $sheetIsPresented, content: { 						SheetView() 				}) 		} } struct SheetView: View { 	 		var body: some View { 				Color.red 		} } I was able to fix this problem by removing line .navigationViewStyle(StackNavigationViewStyle()), but I need StackNavigationViewStyle in my project. Any help will be appreciated.
5
1
5.0k
Nov ’20
Text timer inside ScrollView?
Code: struct ContentView: View { 		var body: some View { 				ScrollView { 						Text(Date(), style: .timer) 				} 		} } Produces crash: Thread 1: EXC_BREAKPOINT in: DisplayList.ViewUpdater.ViewCache.setNextUpdate(_:item:state:tag:) () Any recommendations/workarounds?
1
0
528
Oct ’20
Setting navigationViewStyle to StackNavigationViewStyle is breaking ColorPicker
Why setting  .navigationViewStyle(StackNavigationViewStyle())breaks ColorPicker? This is happening only on a device (works on simulator). Run the app (tested on device running iOS 14.0 and 14.0.0) Navigate to child view Press on color picker button (color sheet will be presented) Try to select any color(-s). onChange is not triggered and state is not being updated. If you dismiss color picker and select color picker again then everything will be working. If you remove setting navigationViewStyle, everything is working as expected. struct ContentView: View { 		var body: some View { 				NavigationView { 						NavigationLink("Open Child", destination: ChildView()) 				} 				.navigationViewStyle(StackNavigationViewStyle()) 		} } struct ChildView: View { 		 		@State private var selectedCustomColor = Color.purple 		 		var body: some View { 				VStack { 						ColorPicker("", selection: $selectedCustomColor) 						Spacer() 				} 				.background(selectedCustomColor) 				.onChange(of: selectedCustomColor, perform: { value in 						print("on change") 				}) 		} }
0
0
391
Oct ’20
Simulate failed transaction using StoreKitTest
I am trying to use StoreKitTest to simulate .failed transaction in my unit tests. For the test session I set: testSession.failTransactionsEnabled = true testSession.failureError = SKError.Code.unknown after that I call: testSession.buyProduct(productIdentifier: productIdentifier) I assumed that  func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction])  delegate method should be called with transactionState failed. Unfortunately the delegate method is not called, any ideas why? I was able to simulate purchased transaction using StoreKitTest. I am using Xcode Version 12.0 beta 6.
1
0
555
Aug ’20
Widget is not showing using Ad Hoc distribution
Is it possible at this moment (using iOS beta 3, Xcode beta 3) to distribute app that has widget extension using Ad hoc distribution? I am able to run the app with a widget directly on a device using debug configuration but as soon as I archive and distribute it using Ad hoc the widget is not showing up in the widget gallery. Though the app is running fine. Any help would be appreciated.
2
0
1.1k
Aug ’20