Yasuhiro Inami
May 23, 2017
1.5k

# 忙しいSwiftエンジニアのためのKotlin入門

Swift愛好会 vol19 (May 23, 2017)
https://love-swift.connpass.com/event/55236/

May 23, 2017

## Transcript

2. None
3. None
4. None
5. None

12. ### SwiftKotlin • ίϚϯυϥΠϯʴMacΞϓϦʹΑΔ Swift → Kotlinม׵ • 2017/05/23ݱࡏɺͦͦ͜͜ରԠ (Status: 50%)

• ཪଆͰ͸ nicklockwood/SwiftFormat (ࣈ۟ղੳث) Λ࢖༻ • ΋ͬͱASTϨϕϧͰ͖ͪΜͱ࣮૷͍ͨ͠ ! • SourceKittenɺswiftc -dump-astɺํ๏͸͍Ζ͍Ζɾɾɾ • ࠷ۙɺΠέͯΔϥΠϒϥϦ͕։ൃ͞Εͨ

15. ### SwiftScript https://devpost.com/software/swiftscript-a-transpiler-from- swift-to-javascript Goal Swift ͔Β JavaScript ʹม׵͢ΔτϥϯεύΠϥͷϓϩτλΠϓ ͱɺ TypeScript

Playground ͷΑ͏ͳσϞ༻ͷΦϯϥΠϯ REPL ͷ։ൃ
16. ### SwiftScript • SwiftAST • Expression, Statement, LiteralͳͲͷܕ৘ใ • SwiftParse •

Swiftίʔυ → AST΁ͷม׵ (tryswift/TryParsecΛ࢖༻) • SwiftScript (JavaScriptม׵) • VisitorύλʔϯΛ࢖ͬͨ AST → JavaScriptίʔυม׵
17. ### // Swift let numbers: [Int] = [2, 3, 5] for

number in numbers { print(number) } let squared = numbers.map { \$0 * \$0 } ɹɹɹɹɹ‑‑‑ // JavaScript (ES6) const numbers = [2, 3, 5]; for (number of numbers) { console.log(number); } const squared = numbers.map(x => x * x);

20. ### // Swift let numbers: [Int] = [2, 3, 5] for

number in numbers { print(number) } let squared = numbers.map { \$0 * \$0 } ɹɹɹɹɹ‑‑‑ // Kotlin val numbers: Array<Int> = arrayOf(2, 3, 5) for (number in numbers) { print(number) } val squared = numbers.map({ it * it })
21. ### Add SwiftKotlin & improve Parse by inamiy · Pull Request

#23 · swift-script/swift-script

23. ### ·ͱΊ • Google I/O 2017ͰɺAndroid͕KotlinΛ࠾༻ ! • angelolloqui/SwiftKotlin • ͱͯ΋ྑ͍ग़དྷ͚ͩͲɺࣈ۟ղੳࢭ·Γ

• SwiftScript • ASTϨϕϧͰॲཧ͕Մೳ • Swift͚ͩॻ͍ͯɺເͷKotlinରԠ✨#✨