Season

PHOTO EMBED

Wed Mar 23 2022 09:21:04 GMT+0000 (Coordinated Universal Time)

Saved by @senorganso #swift

extension Season {
    static var current: Season {
        let calendar = Calendar.current
        let date = Date()
        
        let dateComponents = calendar.dateComponents([.year], from: date)
        return dateComponents.year!
    }
    
    static var all: [Season] {
        let current: Season = .current
        return Array(1950...current).reversed()
    }
}
content_copyCOPY