Post

Replies

Boosts

Views

Activity

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 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.
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.
Dec ’21
Reply to Playground 4 App doesn’t have code snippets?
Seems you are right and I cannot find a code snippet icon { } tapping +. (iPad mini 6) I guess Apple's designers of Swift Playgrounds have chosen some more specific set of code snippets for App project, rather than basic code snippets found in Playgrounds projects. Maybe they might be expecting that the users of App projects would be more experienced than users of Playground projects. You may send a feature request using the Feedback Assistant.
Dec ’21
Reply to Using Combine-Future to Fetch Server Data
What am I doing wrong?  In your code, you are making viewModel a local variable, so it will be released just after print("Yeah..."). Please try something like this: class ViewController: UIViewController { // MARK: - Variables private var cancellableSet: Set<AnyCancellable> = [] var viewModel: ViewModel! //<- // MARK: - Life cycle override func viewDidLoad() { super.viewDidLoad() let urlStr = "https://api.github.com/repos/ReactiveX/RxSwift/events" viewModel = ViewModel(urlStr: urlStr, waitTime: 2.0) //<- No `let` here` viewModel.fetchData(urlText: viewModel.urlStr, timeInterval: viewModel.waitTime) .sink { completion in print("complete") } receiveValue: { dataSet in print("count: \(dataSet)") } .store(in: &cancellableSet) print("Yeah...") } }
Dec ’21