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 | |
extension UIView { | |
/// Swizzlie a process to warn of breaking autolayout. | |
static func swizzleBreakedLayoutWarning() { | |
let anyClass: AnyClass = UIView.self | |
let originalSelector = Selector(("engine:willBreakConstraint:dueToMutuallyExclusiveConstraints:")) | |
let swizzledSelector = #selector(swizzledEngine(_:willBreak:dueTo:)) | |
guard let originalMethod = class_getInstanceMethod(anyClass, originalSelector), |
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
Apple Swift version 4.2 (swiftlang-1000.0.16.7 clang-1000.10.25.3) |
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
let touples = [("Apple", 1), ("Orange", 2), ("Grape", 3)] | |
// ["Grape": 3, "Orange": 2, "Apple": 1] | |
let dictionary = Dictionary(uniqueKeysWithValues: touples) |
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
struct Person { | |
let name: String | |
let age: Int | |
} | |
extension Person { | |
class Helper: NSObject, NSCoding { |
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
struct FooFooFooFooFoo { | |
static func bar() { } | |
func baz() { | |
FooFooFooFooFoo.bar() // Before | |
type(of: self).bar() // Before | |
Self.bar() // After | |
} | |
} |
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
player.setQueueWithStoreIDs(storeIds) |
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
post_install do |installer| | |
installer.pods_project.targets.each do |target| | |
target.build_configurations.each do |config| | |
config.build_settings['EXPANDED_CODE_SIGN_IDENTITY'] = "" | |
config.build_settings['CODE_SIGNING_REQUIRED'] = "NO" | |
config.build_settings['CODE_SIGNING_ALLOWED'] = "NO" | |
end | |
end | |
end |
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 | |
protocol Personal { | |
var name: String { get } | |
init(name: String) | |
func sayHelloTo(person: Personal) | |
} |
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
override func viewDidLoad() { | |
super.viewDidLoad() | |
let search = MKLocalSearch(request: request) | |
search.startWithCompletionHandler { response, error in | |
response?.mapItems.forEach { item in | |
let point = MKPointAnnotation() | |
point.coordinate = item.placemark.coordinate |
NewerOlder