mirror of
https://github.com/ivanvorobei/SwiftUI.git
synced 2026-01-18 23:07:01 +01:00
31 lines
819 B
Swift
Executable File
31 lines
819 B
Swift
Executable File
/*
|
||
See LICENSE folder for this sample’s licensing information.
|
||
|
||
Abstract:
|
||
An object that models a user profile.
|
||
*/
|
||
import Foundation
|
||
|
||
struct Profile {
|
||
var username: String
|
||
var prefersNotifications: Bool
|
||
var seasonalPhoto: Season
|
||
var goalDate: Date
|
||
|
||
static let `default` = Self(username: "g_kumar", prefersNotifications: true, seasonalPhoto: .winter)
|
||
|
||
init(username: String, prefersNotifications: Bool = true, seasonalPhoto: Season = .winter) {
|
||
self.username = username
|
||
self.prefersNotifications = prefersNotifications
|
||
self.seasonalPhoto = seasonalPhoto
|
||
self.goalDate = Date()
|
||
}
|
||
|
||
enum Season: String, CaseIterable {
|
||
case spring = "🌷"
|
||
case summer = "🌞"
|
||
case autumn = "🍂"
|
||
case winter = "☃️"
|
||
}
|
||
}
|