1. Passing Data ->
2. Learning to Xcode Documetnation
3. State vs Binding
4. Debugging -> Ui didn't update
State vs Binding
State -> Parent
Binding -> Child
Binding -> Child2
SRC: https://www.swiftdevjournal.com/passing-data-to-swiftui-views/
var body: some View { // any type of View
Text("Hello, World!")
}
Feature | Playground | Xcworkspace |
---|---|---|
Purpose | Experimentation | Managing projects |
File extension | .playground | .xcworkspace |
Single file or container | Single file | Container |
Live coding | Yes | No |
Build applications | No | Yes |
Include other projects | No | Yes |
0. Easy way
AsyncImage(url: URL(string: "https://image_url_address"))
1. Way API Requests
https://odenza.medium.com/how-to-display-image-from-url-string-in-swiftui-supporting-ios-13-8c988f8d24bc
2. Way URL
URL -> get Data
1. Security
2. Size of App
3. RAM ->
extension String {
func load() -> UIImage {
do {
guard let url = URL(string: self) else {
return UIImage()
}
let data :Data = try Data(contentsOf: url)
return UIImage(data: data) ?? UIImage()
} catch {
}
return UIImage()
}
}
https://developer.apple.com/documentation/foundation/url_loading_system/fetching_website_data_into_memory