This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Date { | |
///*** Returns the amount of years from another date | |
func years(from date: Date) -> Int { | |
return Calendar.current.dateComponents([.year], from: date, to: self).year ?? 0 | |
} | |
///*** Returns the amount of months from another date | |
func months(from date: Date) -> Int { | |
return Calendar.current.dateComponents([.month], from: date, to: self).month ?? 0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are many ways of integrating Swift-Lint. I am going with the homebrew option. | |
First Install homebrew on your mac : | |
Open Terminal and enter below command : | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
Once done enter below command : | |
brew install swiftlint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ContentView.swift | |
// SwiftUIDemo1 | |
// | |
// Created by Shirish Bankar on 16/03/21. | |
// | |
import SwiftUI | |
struct ContentView: View { |