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
// | |
// ColorHelper.swift | |
// Wildcard | |
// | |
// Created by Samuel Beek on 24/06/15. | |
// Copyright (c) 2015 Wildcard. All rights reserved. | |
// | |
import UIKit |
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
// example if(Devices.iPhone4) { view.alpha = 0 } | |
struct Devices { | |
static let iPhone4 = UIScreen.mainScreen().bounds.size.height == 480.0 | |
static let iPhone5 = UIScreen.mainScreen().bounds.size.height == 568.0 | |
static let iPhone6 = UIScreen.mainScreen().bounds.size.height == 667.0 | |
static let iPhone6plus = UIScreen.mainScreen().bounds.size.height == 736.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
// | |
// Analytics.swift | |
// Instant | |
// | |
// Created by Samuel Beek on 21/10/15. | |
// Copyright © 2015 Samue Beek. All rights reserved. | |
// | |
struct Analytics { | |
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
[ | |
{ | |
"code": "AD", | |
"emoji": "🇦🇩", | |
"unicode": "U+1F1E6 U+1F1E9", | |
"name": "Andorra", | |
"title": "flag for Andorra" | |
}, | |
{ | |
"code": "AE", |
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
struct Uploader { | |
static let baseUrl = "YOUR API URL" | |
static func multipartBody(filePathKey: String, imageDataKey: NSData, boundary: String) -> NSData { | |
let body = NSMutableData(); | |
let filename = "user-profile.jpg" | |
let mimetype = "image/jpg" | |
body.appendString("--\(boundary)\r\n") |
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 Foundation | |
extension String { | |
func containsNumbers() -> Bool { | |
// check if there's a range for a number | |
let range = self.rangeOfCharacterFromSet(.decimalDigitCharacterSet()) |
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
// | |
// DeviceHelpers.swift | |
// | |
// Created by Samuel Beek on 08/10/15. | |
// Copyright © 2015 Samue Beek. All rights reserved. | |
// | |
import UIKit | |
struct Devices { | |
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
// src: http://stackoverflow.com/questions/31651983/swift-how-to-remove-border-from-segmented-control | |
import UIKit | |
extension UISegmentedControl { | |
func removeBorders() { | |
setBackgroundImage(imageWithColor(backgroundColor!), forState: .Normal, barMetrics: .Default) | |
setBackgroundImage(imageWithColor(tintColor!), forState: .Selected, barMetrics: .Default) | |
setDividerImage(imageWithColor(UIColor.clearColor()), forLeftSegmentState: .Normal, rightSegmentState: .Normal, barMetrics: .Default) | |
} |
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
struct Platform | |
{ | |
static let isSimulator: Bool = { | |
var isSim = false | |
#if arch(i386) || arch(x86_64) | |
isSim = true | |
#endif | |
return isSim | |
}() | |
} |
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
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { | |
UINavigationBar.appearance().tintColor = UIColor.whiteColor() | |
UINavigationBar.appearance().barStyle = UIBarStyle.Black | |
// rest of the didFinishLaunch stuff | |
} |