alexpaul / SwiftUI

SwiftUI Sample Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftUI

This repo contains SwiftUI code which showcases View components like List, AsyncImage, Property Wrappers like @Binding and much more SwiftyUI snacks. I've also created a few sample SwiftUI apps which you will find below. Text("Enjoy!")

Throughout this repo you'll come across "try? it out" code snippets, copy, paste into a SwiftUI ContentView or similar test View.


Questions to keep in mind when designing a SwiftUI View

  • What data does the view need?
  • How will it use that data?
  • Where does the data come from?

Questions from Data Essentials in SwiftUI - WWDC20


Screen Shot 2022-10-31 at 1 41 10 PM

try? it out

import SwiftUI

struct ContentView: View {

    var body: some View {
        VStack {
            Image("swiftui-logo")
            Text("SwiftUI")
                .foregroundColor(.white)
                .font(.largeTitle)
                .bold()
                .padding(.bottom, 20)
            Text("SwiftUI helps you build great-looking apps across all Apple platforms with the power of Swift — and surprisingly little code. You can bring even better experiences to everyone, on any Apple device, using just one set of tools and APIs.")
                .multilineTextAlignment(.center)
                .foregroundColor(.white)
        }
        .frame(maxWidth: .infinity, maxHeight: .infinity)
        .background(.black)
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

My Sample SwiftUI Apps


SwiftUI @ WWDC

2022

2021

2020

Apple SwiftUI Resources


Buy Me A Coffee If any of the info here was valuable in your SwiftUI quest.

About

SwiftUI Sample Code

License:MIT License