Skip to content

edwinbernadus/starter-template-swiftui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

starter-template-swift-ui

Getting Started

** read this first **
https://github.com/edwinbernadus/starter-template-frontend-framework

Snippet List

  • hint_create_button
// hint_create_button
Text("Go To Next Page")
  • hint_open_new_page
// hint_open_new_page
NavigationLink(destination: ListView()) {
    Text("Go To Next Page")
}
  • hint_loading_webservice
guard let url = URL(string: "https://jsonplaceholder.typicode.com/albums") else {
    print("Invalid URL")
    return
}
do {
    // hint_loading_webservice
    let (data, _) = try await URLSession.shared.data(from: url)
    let album = try? JSONDecoder().decode(Album.self, from: data)
    self.albumCollection = album ?? Album()
} catch {
    print("Invalid data")
}
  • hint_show_loading_indicator
print("loading page")
// hint_show_loading_indicator
self.isLoading = true
print("isLoading",isLoading)
  • hint_show_webservice_result_on_list
// hint_show_webservice_result_on_list
List {
    ForEach(self.albumCollection) { index in
        Text(index.title)
        // hint_button_on_list
        Button("Show Info Detail") {
            // hint_show_detail_item_on_alert
            self.infoDialog = String(index.id) + " - " + index.title
            presentAlert = true
        }
        Spacer()
    }
}
  • hint_button_on_list
// hint_button_on_list
Button("Show Info Detail") {
    self.infoDialog = String(index.id) + " - " + index.title
    presentAlert = true
}
  • hint_show_detail_item_on_alert
// hint_show_detail_item_on_alert
self.infoDialog = String(index.id) + " - " + index.title
presentAlert = true

About

starter template swiftUI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages