Hello guys, I´m new to the forum and have a question concerning a http request which should be established without a button clicked. Basically I would like to have everything inside the button´s action tag done automatically without a button clicked. Thanks in advance. Nikias Here is my code from the ts.view : import SwiftUI struct ContentView: View { @State var username: String = ... @State var password: String = ... var body: some View { ZStack { VStack { Button(action: { if 1==1 { let myUrl = URL(string: var request = URLRequest(url:myUrl!) request.httpMethod = POST// Compose a query string let postString = Name=($username)&Passwort=($password); request.httpBody = postString.data(using: String.Encoding.utf8); let task = URLSession.shared.dataTask(with: request) { (data: Data?, response: URLResponse?, error: Error?) in if error != nil { print(error=(error)) return } // You can print out response object print(response = (response)) //Let's convert response se
19
0
4.2k