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
defaults write xcodebuild PBXNumberOfParallelBuildSubtasks 4 | |
defaults write xcodebuild IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4 | |
defaults write com.apple.xcode PBXNumberOfParallelBuildSubtasks 4 | |
defaults write com.apple.xcode IDEBuildOperationMaxNumberOfConcurrentCompileTasks 4 |
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 | |
// Swift rewrite challenge | |
// Starting point: https://gist.github.com/jkereako/200342b66b5416fd715a#file-scale-and-crop-image-swift | |
func scaleAndCropImage( | |
image: UIImage, | |
toSize size: CGSize, | |
fitImage: Bool = true | |
) -> UIImage { |
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
@jamiepinkham | |
public extension ObservableType { | |
func then(closure: () -> Observable<E>?) -> Observable<E> { | |
return then(closure() ?? .empty()) | |
} | |
func then(@autoclosure(escaping) closure: () -> Observable<E>) -> Observable<E> { | |
let next = Observable.deferred { |
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 | |
extension UIView { | |
func round(with radius: CGFloat, corners: UIRectCorner) { | |
let roundedPath = UIBezierPath(roundedRect: bounds, | |
byRoundingCorners: corners, | |
cornerRadii: CGSize(width: radius, height: radius)) | |
let maskLayer = CAShapeLayer() | |
maskLayer.path = roundedPath.cgPath |
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 Foundation | |
class StreamReader { | |
let encoding: String.Encoding | |
let chunkSize: Int | |
let fileHandle: FileHandle | |
var buffer: Data | |
let delimPattern : Data | |
var isAtEOF: Bool = false | |
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
//Inspired by: http://merowing.info/2017/04/using-protocol-compositon-for-dependency-injection/ | |
//Protocols for objects owning services. Interactors in VIPER, for example. | |
protocol HasLogService { | |
var logService: LogService { get } | |
} | |
protocol HasLoginService { | |
var loginService: LoginService { get } | |
} |
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 +=<T>(lhs: inout T?, rhs: T) where T: SignedNumeric { | |
switch lhs { | |
case .none: | |
break | |
case .some(let value): | |
lhs = .some(value + rhs) | |
} | |
} | |
func -=<T>(lhs: inout T?, rhs: T) where T: SignedNumeric { |
(check out What's New in Swift at 11:40, slide 42)
When you look up how to compile swift faster for debug builds, people very earnestly give advice that seems contradictory: you should "try using the whole module optimization flag," and also "never use whole module optimization for debugging". [^1]
This is confusing because some of us are using these two general words:
compilation: "turning text into an executable program"
OlderNewer