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 { | |
func daysBetweenDates(start: Date, end: Date) -> Int { | |
let days = Calendar.current.dateComponents([.day], from: start, to: end).day! | |
let returnDays = days+1 | |
return returnDays | |
} | |
func secondsBetweenDates(start: Date, end: Date) -> Int { | |
let seconds = Calendar.current.dateComponents([.second], from: start, to: end).second! |
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
import UIKit | |
protocol StoryboardIdentifiable { | |
static var storyboardIdentifier: String { get } | |
} | |
extension StoryboardIdentifiable where Self: UIViewController { | |
static var storyboardIdentifier: String { | |
return String(describing: self) | |
} |
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 UIView { | |
//adding subview to a view, animated | |
func animateIn(view: UIView) { | |
self.backgroundColor = .clear | |
self.addSubview(view) | |
view.transform = CGAffineTransform(scaleX: 1.2, y: 1.2) | |
view.alpha = 0 | |
UIView.animate(withDuration: 0.3) { | |
view.transform = CGAffineTransform(scaleX: 1.0, y: 1.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
import UIKit | |
class ProgressBar: UIView { | |
// MARK: - Properties | |
@IBInspectable var color: UIColor = .gray { | |
didSet { setNeedsDisplay() } | |
} | |