SwiftUI_visionOS_Note

N - Voice Record

1 min read|

Set up the Color extension

  1. Under Core → Extension → Color+Extension, create a list of custom colour pallet.
  1. Simply Edit → Format → Show Color, you can drag and drop the colour you want, instead of writing all colorLiterals
extension Color {
    static let customBackgroundGreen = Color(#colorLiteral(red: 0.9361696839, green: 0.9755526185, blue: 0.918125093, alpha: 1))
    static let customBlack = Color(#colorLiteral(red: 0, green: 0, blue: 0, alpha: 1))
    static let customCoolGray = Color(#colorLiteral(red: 0.9843137255, green: 0.9843137255, blue: 0.9843137255, alpha: 1))
    static let customGray0 = Color(#colorLiteral(red: 0.8901960784, green: 0.8901960784, blue: 0.8901960784, alpha: 1))
    static let customGray1 = Color(#colorLiteral(red: 0.8509803922, green: 0.8509803922, blue: 0.8509803922, alpha: 1))
    static let customGray2 = Color(#colorLiteral(red: 0.6549019608, green: 0.6549019608, blue: 0.6549019608, alpha: 1))
    static let customGreen = Color(#colorLiteral(red: 0.1254901961, green: 0.8078431373, blue: 0.4666666667, alpha: 1))
    static let customIconGray = Color(#colorLiteral(red: 0.5215686275, green: 0.5215686275, blue: 0.5215686275, alpha: 1))
    static let customOrange = Color(#colorLiteral(red: 0.9960784314, green: 0.7529411765, blue: 0.5215686275, alpha: 1))
    static let customSky = Color(#colorLiteral(red: 0.8980392157, green: 0.9568627451, blue: 0.9725490196, alpha: 1))
    static let customWhite = Color(#colorLiteral(red: 1, green: 1, blue: 1, alpha: 1))
}
swift

Create Onboarding Model

  1. Under Model - Onboarding - OnboardingContent, we create a Hashable Model Type
    1. Hashable: it will be used in tabview. → What is Hashable?
  1. OnboardingContent will have following content
    var imageFileName: String
    var title: String
    var subTitle: String
swift
  • Means, we can bring the imageFileName by calling String
  1. Create initializer
    init(
        imageFileName: String,
        title: String,
        subTitle: String) {
        self.imageFileName = imageFileName
        self.title = title
        self.subTitle = subTitle
    }
swift

Subscribe to our newsletter

Get the latest news and updates from our team