Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Java プログラマーのための Swift 入門 #中央線Meetup

484 views

Published on

2018/11/30 に開催された中央線 meetup の資料です。

* Swift 概要
* Java プログラマーがつまずくSwiftの仕様/Swiftの羨ましい仕様
* Swift の Web フレームワーク(特に smoke-framework)の紹介

Published in: Software
  • ACCESS that WEBSITE Over for All Ebooks (Unlimited) ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... DOWNLOAD FULL EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M }
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes.........ACCESS WEBSITE Over for All Ebooks ..... (Unlimited) ......................................................................................................................... Download FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • (Unlimited)....ACCESS WEBSITE Over for All Ebooks ................ accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes ......................................................................................................................... DOWNLOAD FULL PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M }
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • accessibility Books Library allowing access to top content, including thousands of title from favorite author, plus the ability to read or download a huge selection of books for your pc or smartphone within minutes DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://urlzs.com/UABbn } ......................................................................................................................... Download Full EPUB Ebook here { https://urlzs.com/UABbn } ......................................................................................................................... ...................................ALL FOR EBOOKS................................................. Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ACCESS WEBSITE for All Ebooks ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m77EgH } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m77EgH } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Java プログラマーのための Swift 入門 #中央線Meetup

  1. 1. Java Swift @mike_neck 2018/11/30 meetup
  2. 2. • Java Swift • • Java / • Web
  3. 3. • • @mike_neck • L is B Java • golang • POSIX Swift swift-regex
  4. 4. • • Wikipedia •
  5. 5. Swift macOS
  6. 6. Swift • 2014 iOS/macOS Apple • 2015 12 • https://github.com/apple/swift • 4.2.1 • iOS/macOS Linux(Ubuntu + Android?)
  7. 7. • macOS • XCode • XCodeToolchain • …
  8. 8. • Ubuntu(18.04/16.04/14.04) • shared libraries • clang 3.8 • libcurl-dev/libicu-dev/libssl-dev/ libdispatch-dev/libxml-dev • https://swift.org/download/#releases
  9. 9. • Docker • docker library (ubuntu 16.04 ) • docker pull swift:4.2.1
  10. 10. ( ) • IDE • AppCode / CLion • JetBrains Objective-C/Swift/C/C++ IDE • 3 4 IntelliJ Platform (postfix completion …) • AppCode .xcodeproj • CLion Swift Package Manager( )
  11. 11. ( ) • Swift Package Manager • Java Maven/Gradle Apple (Linux ) • ( / ) • •
  12. 12. Swift Package Manager # swift package init —type executable # swift package resolve # XCode/AppCode swift package generate-xcodeproj # swift build # swift test
  13. 13. ( )
  14. 14. Java / Swift • extension[ ] • [ ] • enum[ ] • (var)/ (let)/ (struct/enum)/ (class)[ ]
  15. 15. extension[ ] • protocol protocol Monoid { static var zero: Self func mappend(_ other: Self) -> Self } extension String: Monoid { static var zero: String { return “” } func mappend(_ other: String) -> String { return self + other } }
  16. 16. [ ] • // Monoid extension Array where Element: Monoid { func reduce() -> Element { self.reduce(Element.zero) {(elem: Element, value: Element) in return value.mappend(elem) } } } [“foo”,”bar”,”baz”].reduce() // -> foobarbaz
  17. 17. enum[ ] • Java • Java / • Java
  18. 18. enum enum Answer { case yes // / case no } enum Either<L, R> { // case left(value: L) // case right(value: R) func map<T>(_ f: (R) -> T) -> Either<L, T> { switch self { case .left(let v): return .left(v) case .right(let v): return .right(f(v)) } } }
  19. 19. / [ ] • (var) (let) • var int = 10 int = 20 // let value = 10 value = 20 //
  20. 20. / [ ] • (struct/enum) • (class) struct User { // let id: Int var name: String } class Handler { // var done: EventLoopPromise<Void> }
  21. 21. / [ ] • var ( ) struct User { // let id: Int var name: String } var user = User(id: 20, name: “ ”) user.name = “ ” // OK let user = User(id: 100, name: “ ”) user.name = “ ” // NG
  22. 22. Web
  23. 23. Kitura • http://www.kitura.io/ • IBM • • /ORM/Logger/template /Security
  24. 24. Vapor • https://vapor.codes/ • • • /ORM/Security
  25. 25. Smoke Framework • https://github.com/amzn/smoke-framework • Amazon • smoke • smoke-aws(Swift aws client) • smoke-http(HTTP Client) • smoke-aws-credentials( aws credential FW) • smoke-dynamoDB (dynamoDB )
  26. 26. Smoke Framework • • • •
  27. 27. func handler(msg: Message, ctx: MyContext) throws -> Message { print(“receive message: (msg)”) return msg }
  28. 28. typealias Selector = StandardSmokeHTTP1HandlerSelector< MyContext,JSONPayloadHTTP1OpetaionDelegate> var selector = Selector() selector.addHandlerForUri( “/app”, httpMethod: .POST, operation: handler, allowedErrors: [(MyError.err, 400)], operationDelegate: nil)
  29. 29. do { try SmokeHTTP1Server.startAsOperationServer( withHandlerSelector: selector, andContext: MyContext(), defaultOperationDelegate: JSONPayloadHTTP1OperationDelegate()) } catch { print(“failed to start server: (error)”) }
  30. 30. Works fine!! curl -i http://localhost:8080/app -d ‘{“text”:”test”}’ HTTP/1.1 200 OK Content-Type: application/json Content-Length: 22 { "text" : "test" }
  31. 31. Swift Advent Calendar 2018 https://mike- neck.hatenadiary.com/entry/ smoke-framework
  32. 32. Swift

×