DEV Community

loading...
Cover image for Freestyle Code #3

Freestyle Code #3

tookooltech profile image 4-in-1 Telecommunications ・1 min read

Freestyle Code 3

Freestyle Code #3 is based on Freestyle Code #2 broken down to the very basics of SwiftUI.
In this video, is a demonstration of a Single Artist View inside of Xcode 12, using Apple’s new SwiftUI
to declare user interface such as:

SwiftUI Framework: Text View, Modifiers, Image View, Stacks, Spacer, Safe Area
Control Views: ButtonView

import SwiftUI

struct SingleArtist: View {
  var body: some View {
      HStack {
       // Replace Image 
        Image("Big Sean")
            .resizable()
            .frame(width: 100, height: 100) 
            .cornerRadius(20)
            . padding()
      VStack(alignment: .leading) {
          HStack {
              Text("Big Sean")
              Image(systemName: "checkmark.seal.fill")
                  .foregroundColor(.blue)
                  .font(.system(size: 19, weight: .regular))
           }
              Text("HipHop Artist of 2020")
                  .font(.title3)
              Text("@Big Sean")
                  .font(.title3)
         }
         Spacer()
         HStack {
             Button(action: {} ) {
               Text("Follow")
                 .padding()
                 .foregroundColor(.white)
                 .background(RoundRectangle(cornerRadius: 9)
                          .stroke(Color.white, lineWidth: 2))
               }
          }
          Spacer()
      } .edgesIgnoringSafeArea(.all)
   }
}

// Mark - SingleArtist App Preview
#if DEBUG
struct SingleArtist_Previews: PreviewProvider {
     static var previews: some View {
         SingleArtist()
              .preferredColorScheme(.dark)
  }
}

Enter fullscreen mode Exit fullscreen mode

Discussion (0)

pic
Editor guide