JPMartha's Pancake

This blog is the way to brush up my poor English.

#swiftlang ? Examples of Swift 2.2 & 3.0 Compatibility

Result 2.0.0 was released. ?

It has already supported Swift 3.0. ?

Then, I tried Swift 3.0 in other project! ? It means Swift 2.2 and 3.0 Compatibility. ?

By the way, I don't google it. So, if there are some mistakes, please feel free to correct them. ?

Result 2.0.0Swift 3.0 対応 されたので自分もやってみました。?

といっても手元の環境で動いただけなのであやしいですけどね。 ?


ググってないのでもし間違ってたら教えてください。 ?


Example of SE-0006:

Apply API Guidelines to the Standard Library

ErrorType ? ErrorProtocol

#if swift(>=3.0)
    public typealias PancakeErrorType = ErrorProtocol
    public typealias PancakeErrorType = ErrorType

Generator ? Iterator / CollectionType ? Collection

#if swift(>=3.0)
    func pancake<C: Collection where C.Iterator.Element == String>
    func pancake<C: CollectionType where C.Generator.Element == String>

これは Result 2.0.0パクリ 参考にし ました。

init(count: Int, repeatedValue: Element) ? init(repeating: Element, count: Int)

#if swift(>=3.0)
    let sweets = repeatElement(pancake, count: 500)
    let sweets = Array(count: 500, repeatedValue: pancake)

Example of SE-0011:

Replace typealias keyword with associatedtype for associated type declarations

typealias ? associatedtype

typealias PancakeType = Self

associatedtype PancakeType = Self

Example of SE-0040:

Replacing Equal Signs with Colons For Attribute Arguments

= ? :

#if swift(>=3.0)
    @available(*, deprecated, message:"...")
    @available(*, deprecated, message="...")


#if swift(>=3.0)
    measureBlock {