Post

Replies

Boosts

Views

Activity

Reply to GeometryReader's size is 0 when enclosed inside NavigationView
So is there any elegant way to find out if it's being evaluated the second time?  Always be ready for being evaluated multiple times. It crashes the view because of those 0s. You may need to make your method 0-size-tolerant. (Your code looks like an old C-code and very hard to read. I strongly recommend you to follow the modern coding rules. You are writing code in Swift, not C.) var body: some View { NavigationView { GeometryReader { geometryProxy in VStack { ZStack { if geometryProxy.size != .zero { draw_lines_of_quadrant(screen_width: geometryProxy.size.width, screen_height: geometryProxy.size.height) } } } } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to Swift program
Write a Swift program to test whether a value presents sequentially three times in an array of integers or not Without using in-built function. Is this a homework for you? You would get better responses sooner if you could show what you had done till now.
Topic: Programming Languages SubTopic: Swift Tags:
May ’21
Reply to Issue with Xcode
Thanks for clarification. So, you are trying to build and run the Xcode project created by Visual Studio (for Mac) / Xamarin. The error you mentioned would happen when the project is not properly made for the version of Xcode you are using. It is a problem of Visual Studio / Xamarin, not a problem of Xcode. Visual Studio is not a tool of Apple's and you should better find a community site or a supporting site of Visual Studio / Xamarin.
May ’21
Reply to SwiftUI App crash after keyboard show
You may have tried already (and this may be difficult to apply to your actual app), but this is the only workaround I could have found till now: struct ContentView: View { @State var tradingMode : TradingMode = TradingMode.Equities @State var isShowSecondView = false var body: some View { VStack(content: { Button("show second view") { isShowSecondView.toggle() } TabView { switch tradingMode { case .Equities: VStack(content: { Text("Tab 1 Un") .padding() TextField("ple", text: .constant("")) }) .tabItem { Text("tab 1") }.tag(0) VStack(content: { Text("Tab 2 Un") .padding() TextField("ple", text: .constant("")) }) .tabItem { Text("tab 2") }.tag(1) case .Derivatives: VStack(content: { Text("Tab 1 Der") .padding() TextField("ple", text: .constant("")) }) .tabItem { Text("tab 1") }.tag(0) VStack(content: { Text("Tab 2 Der") .padding() TextField("ple", text: .constant("")) }) .tabItem { Text("tab 2") }.tag(1) } } }) .sheet(isPresented: $isShowSecondView, content: { SecondView(tradingMode: $tradingMode) }) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to SwiftUI App crash after keyboard show
@OOPer, this case like my video. open app - click show second view - click change Change state - focus to "ple" TextField - show keyboard and crash. Thanks for showing the steps. I could reproduce the issue with doing as instructed. In my opinion, this is a bug of the current implementation of SwiftUI. But you would not be able to wait until this issue is fixed by Apple, and may need sort of workarounds. In fact, I was searching for some workarounds for the steps I have shown, no avail till now. I will show you when I find some workaround which works steadily enough.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to Extending AppStorage to be compatible with Int32
I tried extending AppStorage to include an initializer with a RawRepresentable that has Int32 as rawValue but I can't find what to include in it to make it work. I cannot find any public APIs in AppStorage to implement another initializer. You may need another way around for this issue. @AppStorage("locationSettings") var rawLocationSettings: Int = Int(CLAuthorizationStatus.notDetermined.rawValue) var locationSettings: CLAuthorizationStatus { get { return CLAuthorizationStatus(rawValue: Int32(rawLocationSettings))! } set { rawLocationSettings = Int(newValue.rawValue) } } Please share your solution when you find a better way.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21
Reply to Where to learn this world?
I googled it, i'm afraid that i'm going on the wrong way. Seems you are not good at googling. With searching on the web you can find many many resources to learn Swift. Some of them may be good, and many of them may not. And I need a few sources where I can learn all of this stuff. If you insist on learning only a few you would never be able to learn Swift. People who are developing practical apps in Swift have learnt Swift through many resource, not a few. Better start with a few from you can find, and you may need more if they are not sufficient for you. Apple's tutorials - https://developer.apple.com/tutorials/SwiftUI may be a good starting point, but cannot say if it would be the best for you or not.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’21