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 | |
// MARK: - Library | |
public extension UserDefaults { | |
struct Key<Value> { | |
let key: String | |
public init(key: String) { | |
self.key = key |
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
protocol Test { | |
associatedtype Output | |
func test() -> Output | |
} | |
struct A: Test { | |
typealias Output = Void | |
func test() { | |
print("aa") | |
} |
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 | |
func returnsNil() -> UIView? { | |
weak var view: UIView? = UIView() | |
return view | |
} | |
func returnsView1() -> UIView? { | |
weak var view: UIView? | |
view = UIView() |
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
protocol A { | |
func a() | |
} | |
extension A { | |
func a() { | |
print("protocol extension a") | |
} | |
func b() { |
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
/// In contrast to the Swift Zip2Sequence this type will not omit values that don't have a partner due to Sequence length mismatch. | |
/// The Iterator will iterate over `SafeZip2Sequence.Value`. | |
public struct SafeZip2Sequence<Sequence1: Sequence, Sequence2: Sequence> { | |
fileprivate let sequence1: Sequence1 | |
fileprivate let sequence2: Sequence2 | |
} | |
extension SafeZip2Sequence: Sequence { | |
/// An iterator for `SafeZip2Sequence`. | |
public struct Iterator { |
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
// | |
// Example.swift | |
// | |
// Created by Jan Dammshäuser | |
// Copyright © 2016 Jan Dammshäuser. All rights reserved. | |
// | |
import UIKit | |
class ExampleVC: UIViewController { |