This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
import SwiftUI | |
extension Calendar { | |
func generateDates( | |
inside interval: DateInterval, | |
matching components: DateComponents | |
) -> [Date] { | |
var dates: [Date] = [] | |
dates.append(interval.start) |
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { | |
cell.contentView.layer.cornerRadius = 2.0 | |
cell.contentView.layer.borderWidth = 1.0 | |
cell.contentView.layer.borderColor = UIColor.clear.cgColor | |
cell.contentView.layer.masksToBounds = true; | |
cell.layer.shadowColor = UIColor.lightGray.cgColor | |
cell.layer.shadowOffset = CGSize(width:0,height: 2.0) | |
cell.layer.shadowRadius = 2.0 | |
cell.layer.shadowOpacity = 1.0 |
extension NSDate { | |
func timeAgoSinceDate(numericDates:Bool) -> String { | |
let calendar = NSCalendar.currentCalendar() | |
let now = NSDate() | |
let earliest = now.earlierDate(self) | |
let latest = (earliest == now) ? self : now | |
let components:NSDateComponents = calendar.components([NSCalendarUnit.Minute , NSCalendarUnit.Hour , NSCalendarUnit.Day , NSCalendarUnit.WeekOfYear , NSCalendarUnit.Month , NSCalendarUnit.Year , NSCalendarUnit.Second], fromDate: earliest, toDate: latest, options: NSCalendarOptions()) | |
if (components.year >= 2) { | |
return "\(components.year) years ago" |