Version: 1.9.8
Platform: x86_64
First, install or update to the latest system software.
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev
| platform :ios, '8.0' | |
| use_frameworks! | |
| target 'Hungr' do | |
| pod 'QRCodeReader.swift', '~> 6.1.0' | |
| pod 'SwiftyJSON', :git => 'https://github.com/IBM-Swift/SwiftyJSON.git' | |
| pod 'Alamofire', :git => 'https://github.com/Alamofire/Alamofire.git', :branch => 'swift3' | |
| pod 'JSSAlertView' | |
| pod 'ARSLineProgress', '~> 1.0' | |
| pod 'Kingfisher', '~> 2.2' |
| func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
| // Get view controllers from storyboard | |
| let storyboard = UIStoryboard(name: "Main", bundle: nil) | |
| let mainViewController = storyboard.instantiateViewControllerWithIdentifier("MainViewController") as! MainViewController | |
| let sideViewController = storyboard.instantiateViewControllerWithIdentifier("SideViewController") as! SideViewController | |
| let loginViewController = storyboard.instantiateViewControllerWithIdentifier("LoginViewController") as! LoginViewController | |
| let sideNavigationViewController = SideNavigationViewController(mainViewController: mainViewController, leftViewController: sideViewController) | |
| // Configure the window with the SideNavigationViewController as the root view controller | |
| window = UIWindow(frame: UIScreen.mainScreen().bounds) |
| func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| return 3 | |
| } | |
| func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| // | |
| // ViewController.swift | |
| // TimeLapse | |
| // | |
| // Created by Yasin Aktimur on 29.08.2016. | |
| // Copyright © 2016 Yasin Aktimur. All rights reserved. | |
| // | |
| import UIKit |
| extension Float { | |
| var cleanValue: String { | |
| return self % 1 == 0 ? String(format: "%.0f", self) : String(self) | |
| } | |
| } | |
| Usage: | |
| var sampleValue: Float = 3.234 | |
| print(sampleValue.cleanValue) |
| for familyName in UIFont.familyNames as [String] { | |
| print("\(familyName)") | |
| for fontName in UIFont.fontNames(forFamilyName: familyName) as [String] { | |
| print("\tFont: \(fontName)") | |
| } | |
| } |
| // based on https://gist.github.com/samuel-mellert/20b3c99dec168255a046 | |
| // which is based on https://gist.github.com/szhernovoy/276e69eb90a0de84dd90 | |
| // Updated to work on Swift 2.2 | |
| func randomString(length: Int) -> String { | |
| let charactersString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | |
| let charactersArray : [Character] = Array(charactersString.characters) | |
| var string = "" | |
| for _ in 0..<length { |
| func timeAgoSinceDate(date:NSDate, numericDates:Bool) -> String { | |
| let calendar = NSCalendar.currentCalendar() | |
| let now = NSDate() | |
| let earliest = now.earlierDate(date) | |
| let latest = (earliest == now) ? date : 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" | |
| } else if (components.year >= 1){ |