Author: Chris Lattner
This file contains hidden or 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 ExerciseOption: Decodable { | |
| private enum ExerciseOptionCodingKeys: String, CodingKey { | |
| case id | |
| case appleHealthId = "apple_health_id" | |
| case googleFitId = "google_fit_id" | |
| case langsTranslation = "langs_translation" | |
| } | |
This file contains hidden or 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
| public class Channel<Value> { | |
| private class Subscription { | |
| weak var object: AnyObject? | |
| private let notifyBlock: (Value) -> Void | |
| private let queue: DispatchQueue | |
| var isValid: Bool { | |
| return object != nil |
This file contains hidden or 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
| // Coordinator.swift | |
| import Foundation | |
| public protocol Coordinator: class { | |
| var components: CoordinatorComponents { get } | |
| /// Set up here everything that needs to happen just before the Coordinator is presented | |
| /// | |
| /// - Parameter modalSetup: A parameter you can use to customize the default mainViewController's |
This file contains hidden or 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 UIImageView { | |
| /// Loads image from web asynchronosly and caches it, in case you have to load url | |
| /// again, it will be loaded from cache if available | |
| func load(url: URL, placeholder: UIImage?, cache: URLCache? = nil) { | |
| let cache = cache ?? URLCache.shared | |
| let request = URLRequest(url: url) | |
| if let data = cache.cachedResponse(for: request)?.data, let image = UIImage(data: data) { | |
| self.image = image | |
| } else { | |
| self.image = placeholder |
###Sketch trial non stop
Open hosts files:
$ open /private/etc/hosts
Edit the file adding:
127.0.0.1 backend.bohemiancoding.com
127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com
This file contains hidden or 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
| // Returns black if the given background color is light or white if the given color is dark | |
| func textColor(bgColor: UIColor) -> UIColor { | |
| var r: CGFloat = 0.0 | |
| var g: CGFloat = 0.0 | |
| var b: CGFloat = 0.0 | |
| var a: CGFloat = 0.0 | |
| var brightness: CGFloat = 0.0 | |
| bgColor.getRed(&r, green: &g, blue: &b, alpha: &a) |
This file contains hidden or 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
| #if TARGET_OS_IPHONE | |
| @import UIKit; | |
| #define JKColor UIColor | |
| #define JKFont UIFont | |
| #else | |
| @import AppKit; | |
| #define JKColor NSColor | |
| #define JKFont NSFont | |
| #endif |
NewerOlder