iOS - Xcode walkthrough
Contents
1. Passing Data ->
2. Learning to Xcode Documetnation
3. State vs Binding
4. Debugging -> Ui didn't update
Passing Data
State vs Binding
State -> Parent
Binding -> Child
Binding -> Child2
Example

SRC: https://www.swiftdevjournal.com/passing-data-to-swiftui-views/
"some" keyword
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 |
Showing Image from URL
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
Why Image from URL?
1. Security
2. Size of App
3. RAM ->
using URL
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()
}
}
Documentation
https://developer.apple.com/documentation/foundation/url_loading_system/fetching_website_data_into_memory
Passing data from one page to another
By Harnoor Singh
Passing data from one page to another
- 192