Set a variable with current year in Swift August 26, 2023 by Tarik Use Calendar and Date: let year = Calendar.current.component(.year, from: Date())