Skip to content

Instantly share code, notes, and snippets.

View shirishbankar1's full-sized avatar

Shirish Bankar shirishbankar1

  • Josh Software
  • Pune
View GitHub Profile
//
// ContentView.swift
// SwiftUIDemo1
//
// Created by Shirish Bankar on 16/03/21.
//
import SwiftUI
struct ContentView: View {
@shirishbankar1
shirishbankar1 / gist:69f76e51408f1e46fcc3fa1416f7d30b
Created February 25, 2020 07:30
Swift - Lint Integration for iOS Projects
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
@shirishbankar1
shirishbankar1 / gist:3827769804164446cef46915fea3a50d
Created January 21, 2020 09:44
Calculate timespan from given date.
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
}