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

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

Eac0bf787b5279aca5e699ece096956e?s=128

Yasuhiro Inami

May 23, 2017
Tweet

Transcript

  1. ๩͍͠SwiftΤϯδχΞͷͨΊͷ Kotlinೖ໳ 2017/05/23 SwiftѪ޷ձ vol19 Yasuhiro Inami / @inamiy

  2. None
  3. None
  4. None
  5. None
  6. 2017೥ Kotlin͕དྷΔʂʁ

  7. Ͱ΋Swift͔͠ॻ͚ͳ͍ɾɾɾ Ͳ͏͠Α͏!

  8. Kotlinʹೖ໳͢Δʁ!

  9. Swift Ѫ޷ձ

  10. ɹ Kotlinʹೖ໳͢Δ! ! KotlinΛੜ੒͢Δ"

  11. SwiftKotlin https://github.com/angelolloqui/SwiftKotlin

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

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

  14. SwiftScript

  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);
  18. SwiftScript https://github.com/swift-script/swift-script

  19. ͜Εͬͯ JavaScriptҎ֎ʹ΋ ࢖͑ΔͷͰ͸ʁ!

  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
  22. Demo

  23. ·ͱΊ • Google I/O 2017ͰɺAndroid͕KotlinΛ࠾༻ ! • angelolloqui/SwiftKotlin • ͱͯ΋ྑ͍ग़དྷ͚ͩͲɺࣈ۟ղੳࢭ·Γ

    • SwiftScript • ASTϨϕϧͰॲཧ͕Մೳ • Swift͚ͩॻ͍ͯɺເͷKotlinରԠ✨#✨
  24. ๩͍͠SwiftΤϯδχΞͷͨΊͷ Kotlin"ࣗಈੜ੒"ೖ໳

  25. Thanks! Yasuhiro Inami @inamiy