For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.
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
| # | |
| # Shows one way to fail a build in fastlane when code | |
| # coverage does not meet a minimum threshold. | |
| # | |
| # there are other ways to check the coverage of the commit, | |
| # but I couldn't find an existing tool that makes this easier | |
| # that will run on bitrise. I would have normally used diff-cover | |
| # to do this because you can compare branches and only check the diffs. | |
| # Unfortunately that means you have to find a way to install it on bitrise | |
| # at the time of writing and that can be tricky. |
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
| func generate(numRows: Int) -> [[Int]] { | |
| var results = [[Int]]() | |
| if (numRows == 0) { | |
| return results | |
| } | |
| for i in 0..<numRows { | |
| var currentResults = [Int]() | |
| for j in 0...i { | |
| if (i > 1 && j > 0 && j < i) { | |
| let value = results[i-1][j] + results[i-1][j-1] |
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 Realm { | |
| public func rx_objectForPrimaryKey<T: Object>(type: T.Type, key: AnyObject) -> Observable<T?> { | |
| return self.objects(type) | |
| .filter("%K = %@", self.schema[type.className()]!.primaryKeyProperty!.name, key) | |
| .rx_result | |
| } | |
| } | |
| extension Results where T: Object { | |
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 | |
| import RxSwift | |
| import RxCocoa | |
| let requiredUserNameLength = 5 | |
| let requiredPasswordLength = 5 | |
| let limitUserNameLength = 20 | |
| class ValidationViewController: UIViewController { |
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 XCPlayground | |
| import UIKit | |
| struct Pokemon { | |
| let id: UInt | |
| let name: String | |
| } | |
| class PokedexViewController: UITableViewController { | |
| let pokemons: [Pokemon] = [ |
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
| protocol Money { | |
| var value: Double { get } | |
| var inGold: Double { get } | |
| var symbol: String { get } | |
| } | |
| // Sadly, gives a compiler error. | |
| // "Extension of protocol 'Money' cannot have an inheritance clause" | |
| extension Money: CustomStringConvertible { | |
| var description: String { |
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
| @implementation CMFWallpaper | |
| + (void)setImage:(UIImage *)image { | |
| NSAssert([PHPhotoLibrary authorizationStatus] == PHAuthorizationStatusAuthorized, @"access to photos is needed to set the wallpaper"); | |
| NSString *path; | |
| #if TARGET_OS_SIMULATOR | |
| path = @"/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System/Library/PrivateFrameworks/PhotoLibrary.framework"; | |
| #else | |
| path = @"/System/Library/PrivateFrameworks/PhotoLibrary.framework"; |
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
| git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" |