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 String { | |
| func deletingPrefix(_ prefix: String) -> String { | |
| guard hasPrefix(prefix) else { return self } | |
| return String(dropFirst(prefix.count)) | |
| } | |
| } |
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
| let processInfo = ProcessInfo.processInfo | |
| let environment = processInfo.environment | |
| guard let environment["KEY"] else { return } |
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
| // | |
| // ContentView.swift | |
| // AdditiveAnimations | |
| // | |
| // Created by Chris Eidhof on 10.10.19. | |
| // Copyright Β© 2019 Chris Eidhof. All rights reserved. | |
| // https://github.com/objcio/S01E174-animation-curves/blob/master/AnimationCurves/ContentView.swift | |
| import SwiftUI |
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
| // | |
| // ContentView.swift | |
| // Layers | |
| // | |
| // Created by Chris Eidhof on 09.10.19. | |
| // Copyright Β© 2019 Chris Eidhof. All rights reserved. | |
| // https://github.com/objcio/S01E173-building-a-shake-animation/blob/master/Shake/ContentView.swift | |
| import SwiftUI |
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 Dispatching { | |
| func dispatch(_ work: @escaping ()->Void) | |
| } | |
| final class DispatcherStub: Dispatching { | |
| func dispatch(_ work: @escaping ()->Void) { | |
| work() | |
| } | |
| } |
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
| fileprivate extension Selector { | |
| static let doStuff = #selector(ViewController.doStuff) | |
| } |
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
| //Method documentation | |
| /*! | |
| * @brief <#brief#> | |
| * @discussion <#description#>. | |
| * @warning <#warning#>. | |
| * @param <#param description#> | |
| * @return <#return description#> | |
| */ |
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
| @discardableResult | |
| func measure<A>(name: String = "", _ block: () -> A) -> A { | |
| let startTime = CACurrentMediaTime() | |
| let result = block() | |
| let timeElapsed = CACurrentMediaTime() - startTime | |
| print("Time: \(name) - \(timeElapsed)") | |
| return result | |
| } |
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
| (lldb) expr -l Swift -- import UIKit | |
| (lldb) expr -l Swift -- let $pin = unsafeBitCast(0x7df67c50, to: MKPinAnnotationView.self) | |
| (lldb) expr -l Swift -- print($pin.alpha) | |
| //https://stackoverflow.com/questions/29441418/lldb-swift-casting-raw-address-into-usable-type |
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
| - (UIImage *)image { | |
| UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0.0); | |
| [self.layer renderInContext:UIGraphicsGetCurrentContext()]; | |
| UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |
| return image; | |
| } |
NewerOlder