Swiftui button press does not always work

When I press the button "Get New Connection Pin" it does not always print to console. Let’s like I have to press the button a few times before it will print to console or for me to see the button visibly being pressed. swiftui: import SwiftUI struct JokeView: View { @State private var jokeString =… Read More Swiftui button press does not always work

Ambiguous use of appendInterpolation – Why?

When using CustomStringConvertible structs, regular String interpolation works fine, however because Text (SwiftUI) uses LocalizedString interpolation, it doesn’t, and requires you to either fully append .description, or to use Text(verbatim: …) or Text(String(describing…)) Until(?) Apple harmonises the interpolation of String and LocalizedString, it seemed an easy enough fix to create an extension to make interpolation… Read More Ambiguous use of appendInterpolation – Why?

SwiftUI – Initializer 'init(_:)' requires that 'Binding<Int>' conform to 'LosslessStringConvertible'

if(!user.hiddenUsersString.contains(String(meme.userid) + ",")){ } I get Initializer ‘init(_:)’ requires that ‘Binding<Int>’ conform to ‘LosslessStringConvertible’ on String what the hell is this? It worked without errors until yesterday. Why is swift such a pile of garbage :/ >Solution : You can’t pass a Binding to a String init. You need to pass the wrappedValue of the… Read More SwiftUI – Initializer 'init(_:)' requires that 'Binding<Int>' conform to 'LosslessStringConvertible'

SwiftUI iOS16 Table with optional string as keypath

How does one create a TableColumn for an optional property? Do i have to unwrap it in my model to make it an empty string if it is nil? extension SomeObject { var someOptionalStringUnwrapped: String { return someOptionalString ?? "" } } Table(someObject) { TableColumn("Given Name", value: \.someString) TableColumn("Given Name", value: \.someOptionalString) // <–shows error mentioned… Read More SwiftUI iOS16 Table with optional string as keypath

NavigationLink is only tappable on text section

I have a NavigationLink: NavigationLink("Login") { WelcomeView() }.foregroundColor(.white).frame(width:300, height: 50).background(Color.blue).cornerRadius(10).padding().disabled(authenticateUser()) which looks like this: The issue is that the navigation only occurs when the user taps directly on the word "Login". If the user taps anywhere on the blue area outside of the text – no navigation occurs and nothing happens. How do I modify… Read More NavigationLink is only tappable on text section

In a view, how can I change the view's variables every time I press a button, using a struct's function?

I have a problem while coding in content view. I don’t understand how can I use struct’s func in content view. I would like to get helps from you guys. I get an error like this "Result of call to ‘changeText(text:)’ is unused". Here’s simple example of what I’m trying to achieve, import Foundation public… Read More In a view, how can I change the view's variables every time I press a button, using a struct's function?

SwiftUI losing reference while trying to reuse a UIViewRepresentable on different views

I’m trying to reuse a UIKit view on SwiftUI with a UIViewRepresentable. Whenever i tap the representable i want to go to a fullScreenCover and reuse that same UIView. Somehow, when i close the fullscreenView, the UIView is missing. I’ve tried several approaches but i couldn’t make it work, Can some one point me in… Read More SwiftUI losing reference while trying to reuse a UIViewRepresentable on different views