Created
December 1, 2021 18:24
-
-
Save ijaureguialzo/6304ea553c34d222aab48b0be0491519 to your computer and use it in GitHub Desktop.
Prueba de CocoaPods con SwiftUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// EjemploCocoaPods | |
// | |
// Created by Ion Jaureguialzo Sarasola on 1/12/21. | |
// | |
import SwiftUI | |
import Alamofire | |
struct ContentView: View { | |
@State var datos = "..." | |
var body: some View { | |
Text(datos) | |
.padding() | |
.onAppear { | |
leerFecha() | |
} | |
} | |
func leerFecha() { | |
AF.request("https://time.jaureguialzo.com").responseString { response in | |
datos = response.value ?? "?" | |
} | |
} | |
} | |
struct ContentView_Previews: PreviewProvider { | |
static var previews: some View { | |
ContentView() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment