Post

Replies

Boosts

Views

Activity

Reply to Action Button(Textfield)
What I do not understand is that your code shown does not contain any TextField. You should better show more code even if it might not be perfect. That would explain what you want to do better than the too simple example.
Topic: UI Frameworks SubTopic: UIKit Tags:
Dec ’21
Reply to Action Button(Textfield)
Please try something like this: import SwiftUI struct HeartTextSquareView: View { @State private var name: String = "" @State private var adresse: String = "" @State var telefonnummern: [String] = [] //<- @State var something: String = "" var body: some View { VStack { List { TextField("Name/Vorname", text: $name) TextField("Adresse", text: $adresse) ForEach($telefonnummern, id: \.self) {$telefonnummer in TextField("Telefonnummer", text: $telefonnummer) } Button(action: { telefonnummern.append("") }) { Image(systemName: "plus.circle.fill") .foregroundColor(Color(.systemGreen)) } } } //End VStack }//End body }//End `HeartTextSquareView` When you want variable number of UI elements, you need to prepare a variable each element of which represents each UI element.
Topic: UI Frameworks SubTopic: UIKit Tags:
Dec ’21
Reply to Set two var‘s after each other
I want to set the variable „selectedPlaceName“ before setting „showingPopover“ > Can you explain what you want to achieve? If the order of setting the variables is the purpose of you, you are doing it as you describe. If your actual purpose is sort of using selectedPlaceName in the popover, you may need to show more code.
Dec ’21
Reply to Accessing variables in one class from other class
If you want to access some variables common from within the parent view and from within the child view, you may need to hold the variables in the parent view. As Swift View is a struct and modifying the variable inside its instance may cause many behaviors you do not expect. Child View import SwiftUI struct AddNewPresets: View { @Binding var username: String var emailFieldIsFocused: FocusState<Bool>.Binding var body: some View { TextField( "User name (email address)", text: $username ) .focused(emailFieldIsFocused) .onSubmit { //validate(name: username) } .textInputAutocapitalization(.never) .disableAutocorrection(true) .border(.secondary) } } Parent View import SwiftUI struct ContentView: View { @State var username: String = "" @FocusState var emailFieldIsFocused :Bool var body: some View { HStack { AddNewPresets(username: $username, emailFieldIsFocused: $emailFieldIsFocused) Text(username) .foregroundColor(emailFieldIsFocused ? .red : .blue) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’21
Reply to Can I use CloudKit with apps built with Swift Playgrounds 4 on an iPad?
Even when I open the App project of Swift Playground 4 with Xcode 13.2.1, I cannot find iCloud in the capabilities list shown clicking + Capability button. So, I guess it might be one of the not yet features of Swift Playgrounds 4. But not sure as many things of Swift Playgrounds 4 are not yet revealed. I do appreciate if Apple's engineer could clarify.
Topic: App & System Services SubTopic: Hardware Tags:
Dec ’21
Reply to Implement swift API for C++ multi-type structure
can I use the swift Class in objective-c in order to fill it up according to the CPP serverResponse ? You can make your class Objective-C compatible by adding @objc: @objc @objcMembers open class ServerResponseSwift : NSObject { open var error: ErrorMessageSwift open var strValue: String open var intVal: UInt16 //open var status: EnumValSwift init(error: ErrorMessageSwift, strValue: String, intVal: UInt16 ) { self.error = error self.strValue = strValue self.intVal = intVal //self.status = ... } } And you can use it in your Objective-C++ code : #import "SwiftAPICpp-Swift.h" @implementation Converter - (ServerResponseSwift *) getServerStatusSwift { serverResponse x = getServerResponse(); //... ServerResponseSwift *serverResponseSwift = [[ServerResponseSwift alloc] init...]; } @end
Topic: Programming Languages SubTopic: Swift Tags:
Dec ’21
Reply to Action Button(Textfield)
Can you clarify what you want to ask?
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Error in downloading Xcode simulator
So, have you contacted Apple Developer Program Support?
Replies
Boosts
Views
Activity
Dec ’21
Reply to MY GAME IS CRASHING USING XCODE AND I DONT KNO HOW TO FIX
Unity is not a framework of Apple's. You may get a better chance to receive better responses sooner if you visit the supporting site or a community site of Unity.
Replies
Boosts
Views
Activity
Dec ’21
Reply to MY GAME IS CRASHING USING XCODE AND I DONT KNO HOW TO FIX
the issue is coming from unity? > It may be or may not be. Better find the right place and you would get the right answer sooner.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Action Button(Textfield)
What I do not understand is that your code shown does not contain any TextField. You should better show more code even if it might not be perfect. That would explain what you want to do better than the too simple example.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Flutter installation
Flutter is not a framework of Apple's. You would get a better chance to get better responses sooner if you visit the supporting site or a community site of it.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Action Button(Textfield)
Please try something like this: import SwiftUI struct HeartTextSquareView: View { @State private var name: String = "" @State private var adresse: String = "" @State var telefonnummern: [String] = [] //<- @State var something: String = "" var body: some View { VStack { List { TextField("Name/Vorname", text: $name) TextField("Adresse", text: $adresse) ForEach($telefonnummern, id: \.self) {$telefonnummer in TextField("Telefonnummer", text: $telefonnummer) } Button(action: { telefonnummern.append("") }) { Image(systemName: "plus.circle.fill") .foregroundColor(Color(.systemGreen)) } } } //End VStack }//End body }//End `HeartTextSquareView` When you want variable number of UI elements, you need to prepare a variable each element of which represents each UI element.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Set two var‘s after each other
I want to set the variable „selectedPlaceName“ before setting „showingPopover“ > Can you explain what you want to achieve? If the order of setting the variables is the purpose of you, you are doing it as you describe. If your actual purpose is sort of using selectedPlaceName in the popover, you may need to show more code.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Accessing variables in one class from other class
If you want to access some variables common from within the parent view and from within the child view, you may need to hold the variables in the parent view. As Swift View is a struct and modifying the variable inside its instance may cause many behaviors you do not expect. Child View import SwiftUI struct AddNewPresets: View { @Binding var username: String var emailFieldIsFocused: FocusState<Bool>.Binding var body: some View { TextField( "User name (email address)", text: $username ) .focused(emailFieldIsFocused) .onSubmit { //validate(name: username) } .textInputAutocapitalization(.never) .disableAutocorrection(true) .border(.secondary) } } Parent View import SwiftUI struct ContentView: View { @State var username: String = "" @FocusState var emailFieldIsFocused :Bool var body: some View { HStack { AddNewPresets(username: $username, emailFieldIsFocused: $emailFieldIsFocused) Text(username) .foregroundColor(emailFieldIsFocused ? .red : .blue) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Set two var‘s after each other
Seems you need to show more code. What am I doing wrong? One thing clearly wrong is that you are not showing enough code.
Replies
Boosts
Views
Activity
Dec ’21
Reply to Can I use CloudKit with apps built with Swift Playgrounds 4 on an iPad?
Even when I open the App project of Swift Playground 4 with Xcode 13.2.1, I cannot find iCloud in the capabilities list shown clicking + Capability button. So, I guess it might be one of the not yet features of Swift Playgrounds 4. But not sure as many things of Swift Playgrounds 4 are not yet revealed. I do appreciate if Apple's engineer could clarify.
Topic: App & System Services SubTopic: Hardware Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Set two var‘s after each other
Sorry, I have been missing the part where you use popover using selectedPlaceName.
Replies
Boosts
Views
Activity
Dec ’21
Reply to function "picker " can't be found and I don't understand why
In your code, picker is a local variable inside viewDidLoad(). So, the scope of your picker is only inside viewDidLoad(). You may need to declare an instance variable picker, and assign your picker to it in viewDidLoad(). self.picker = picker
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Implement swift API for C++ multi-type structure
can I use the swift Class in objective-c in order to fill it up according to the CPP serverResponse ? You can make your class Objective-C compatible by adding @objc: @objc @objcMembers open class ServerResponseSwift : NSObject { open var error: ErrorMessageSwift open var strValue: String open var intVal: UInt16 //open var status: EnumValSwift init(error: ErrorMessageSwift, strValue: String, intVal: UInt16 ) { self.error = error self.strValue = strValue self.intVal = intVal //self.status = ... } } And you can use it in your Objective-C++ code : #import "SwiftAPICpp-Swift.h" @implementation Converter - (ServerResponseSwift *) getServerStatusSwift { serverResponse x = getServerResponse(); //... ServerResponseSwift *serverResponseSwift = [[ServerResponseSwift alloc] init...]; } @end
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’21
Reply to Xcode 13.2.1
Do you have anything to ask?
Replies
Boosts
Views
Activity
Dec ’21