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.0 ใŒ Swift 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 {