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 UIKit | |
import MapKit | |
extension MKMapView { | |
func showLocation(at coordinate: CLLocationCoordinate2D) { | |
self.removeOverlays(self.overlays) | |
self.removeAnnotations(self.annotations) | |
let annotation = MKPointAnnotation() |
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
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist |
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 | |
import UIKit | |
// Usage Examples | |
let shadowColor = Color.shadow.value | |
let shadowColorWithAlpha = Color.shadow.withAlpha(0.5) | |
let customColorWithAlpha = Color.custom(hexString: "#123edd", alpha: 0.25).value | |
enum Color { | |
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
class MyCustomView : UIView { | |
var sink : AnyObserver<SomeComplexStructure> { | |
return AnyObserver { [weak self] event in | |
switch event { | |
case .next(let data): | |
self?.something.text = data.property.text | |
break | |
case .error(let error): | |
self?.backgroundColor = .red |
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
#set the shell to /bin/sh | |
TAGS="TODO:|FIXME:" | |
find "${SRCROOT}" \( -name "*.swift" \) -type f -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" |
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
var fetchedResultsProcessingOperations: [NSBlockOperation] = [] | |
private func addFetchedResultsProcessingBlock(processingBlock:(Void)->Void) { | |
fetchedResultsProcessingOperations.append(NSBlockOperation(block: processingBlock)) | |
} | |
func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) { | |
switch type { | |
case .Insert: |
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
//: # Swift 3: Using URLComponents | |
import Foundation | |
//: ### Compose the componens | |
var url = URLComponents() | |
url.scheme = "http" | |
url.host = "google.com" | |
//: ### Pass the query string parameters | |
url.queryItems = [ | |
URLQueryItem(name: "test", value: "data"), |
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 UIKit | |
import RxSwift | |
import RxCocoa | |
import RxDataSources | |
class ViewController: BaseCollectionViewController { | |
... | |
typealias Section = AnimatableSectionModel<String, CellStyle> |
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 UIKit | |
import PlaygroundSupport | |
public class InfinityLoader: UIView { | |
let anim = CAAnimationGroup() | |
//// Drawing Methods | |
lazy var path: UIBezierPath = { |
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
//: # Swift 3: CGD and URLSessionDataTask | |
import Foundation | |
import PlaygroundSupport | |
//: ### Create background queue | |
let queue = DispatchQueue.global(qos: .background) | |
//: ### Computed variable | |
var time:DispatchTime! { |
OlderNewer