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/Foundation.h> | |
extern UIImage * UIImageWithJPEG2000Data( NSData * 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
// | |
// UIView+ADBSubviews.h | |
// iHarmony | |
// | |
// Created by Alberto De Bortoli on 06/08/13. | |
// Copyright (c) 2013 iHarmony. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> |
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
NSURLConnection | NSURLSession | |
------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------- | |
NSURLConnectionDelegate connectionShouldUseCredentialStorage: | | |
------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------- | |
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler: | |
| N |
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-1.1 | |
import Foundation | |
// MARK: - (1) classes | |
// Solution 1: | |
// - Use classes instead of struct | |
// Issue: Violate the concept of moving model to the value layer | |
// http://realm.io/news/andy-matuschak-controlling-complexity/ |
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
/*: | |
Stuff from [Crustacean](https://developer.apple.com/sample-code/wwdc/2015/?q=protocol). | |
(Wish I could hide this in a single-file playground somehow.) | |
*/ | |
import CoreGraphics | |
protocol Renderer { | |
func moveTo(position: CGPoint) | |
func lineTo(position: CGPoint) | |
func arcAt(center: CGPoint, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat) |
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
// A Gist. | |
struct Gist { | |
let id: String | |
} | |
typealias JSONDictionary = [String: AnyObject] | |
// These methods are "helpers" to transform Data -> JSON -> Result<[Gist]> | |
func jsonFrom(data: Data) -> Result<AnyObject> { | |
let json = try! JSONSerialization.jsonObject(with: data, options: []) |
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 | |
// https://gist.github.com/erica/6f13f3043a330359c035e7660f3fe7f5 | |
// Original Video: https://www.youtube.com/watch?v=TTmWUSgNOHk | |
// Video: https://www.youtube.com/watch?v=hmAB3WJOQTU | |
// Video: https://www.youtube.com/watch?v=DWtavuvmKdw (with zoom and fade) | |
// String to animate and its attributes | |
var string = "Hello, playground" | |
let attributes: [String: Any] = [ |
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
func polygon(){ | |
// Create a rectangular path | |
let rect = GMSMutablePath() | |
rect.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.0)) | |
rect.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.0)) | |
rect.add(CLLocationCoordinate2D(latitude: 37.45, longitude: -122.2)) | |
rect.add(CLLocationCoordinate2D(latitude: 37.36, longitude: -122.2)) | |
// Create the polygon, and assign it to the map. | |
let polygon = GMSPolygon(path: rect) |
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 | |
extension DateFormatter { | |
static let iso8601Full: DateFormatter = { | |
let formatter = DateFormatter() | |
formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" | |
formatter.calendar = Calendar(identifier: .iso8601) | |
formatter.timeZone = TimeZone(secondsFromGMT: 0) | |
formatter.locale = Locale(identifier: "en_US_POSIX") | |
return formatter |
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
// | |
// UserDefaults.swift | |
// | |
// Created by Shaps Benkau on 24/05/2018. | |
// Copyright © 2018 152percent Ltd. All rights reserved. | |
// | |
import Foundation | |
#if os(iOS) |
OlderNewer