Slide 1

Slide 1 text

ΑΓΑ͍ ωʔϛϯάΛ໨ࢦͯ͠ by. 2017/10/3 Զίϯ Vol.1 / Day.2 1

Slide 2

Slide 2 text

takasek iOS Developer @takasek OSS ActionClosurable Notifwift౳ 2

Slide 3

Slide 3 text

3

Slide 4

Slide 4 text

4

Slide 5

Slide 5 text

ͦ͜·Ͱໃ६͠ͳͯ͘΋… ΍ͬͯ·ͤΜ͔ʁ 4 update() Ͱಛఆͷ৚݅Ͱ͸updateͤͣʹ໭ Δ 4 fetch() ͱ͍͍ͭͭUIͷߋ৽΋ͯ͠Δ 4 ໊લʹࠔͬͯ func didReceive(hoge: Hoge) 5

Slide 6

Slide 6 text

ໃ६ίʔυΛ ͦͷ··ʹͯ͠͠·͏ཧ༝ 4 ΊΜͲ͍͘͞ 4 ಈ͍͍ͯΔίʔυʹ৮Γͨ͘ͳ͍ 4 ద੾ͳ໊લ͕ࢥ͍͔ͭͳ͍ 4 ·͋ɺશମΛಡΊ͹ཧղͰ͖Δ 4 ผʹόά͡Όͳ͍ 6

Slide 7

Slide 7 text

Ͱ΋ɺωʔϛϯάΛ ͦͷ··ʹ ͓ͯ͘͠ͱ… 7

Slide 8

Slide 8 text

1 1 ετϧʔϓޮՌ - Wikipediaɹhttps://ja.wikipedia.org/wiki/ %E3%82%B9%E3%83%88%E3%83%AB%E3%83%BC%E3%83%97%E5%8A%B9%E6%9E%9C 8

Slide 9

Slide 9 text

ໃ६ίʔυ͸ ίʔυϦʔσΟϯάΛ ஗͘͢Δ 9

Slide 10

Slide 10 text

΋ͬͱةݥͳͷ͸ɺ ؔ܎ͳ͍ॲཧ͕ೖΓࠐΉ 伱͕Ͱ͖Δ໰୊ 4 ܕ΍ϝιουͷ੹຿ͷൣғ͕ఆ·Βͳ͍ 4 ܕ΍ϝιου͕ංେԽ͢Δɾॲཧ͕֤ॴʹ෼ࢄ ͢Δ 4 ࠷ѱɺόά͕࢓ࠐ·ΕΔ 10

Slide 11

Slide 11 text

4 update() Ͱಛఆͷ৚݅Ͱ͸updateͤͣʹ໭ Δ 4 σʔλߋ৽ޙ΋ը໘͸ߋ৽͞Εͳ͍… ͱࢥͬͨΒॲཧ్͕தͰguard͞Εͯͨ ! 4 fetch() ͱ͍͍ͭͭUIͷߋ৽΋ͯ͠Δ 4 ࢥΘ͵࣌ʹදࣔ͞ΕΔAlert ⚠ 4 ໊લʹࠔͬͯ func didReceive(hoge: Hoge) 4 isFetching: Bool ͷ؅ཧՕॴ͕෼ࢄʂ # 11

Slide 12

Slide 12 text

໊લ͕;Θͬͱͯ͠Δ͔Β ༨ܭͳ͜ͱΛͯ͠͠·͏ 12

Slide 13

Slide 13 text

Α໊͍લΛ ͚ͭΑ͏✨ 13

Slide 14

Slide 14 text

Ͱ΋ɺͲ͏΍ͬͯʁ 14

Slide 15

Slide 15 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯ 2 1. ໌֬ͳ୯ޠΛબͿ 2. ൚༻తͳ໊લΛආ͚Δʢ͋Δ͍ ͸ɺ࢖͏ঢ়گΛબͿʣ 3. ந৅తͳ໊લΑΓ΋۩ମతͳ໊લ Λ࢖͏ 4. ઀ඌࣙ΍઀಄ࣙΛ࢖ͬͯ৘ใΛ௥ Ճ͢Δ 5. ໊લͷ௕͞ΛܾΊΔ 6. ໊લͷϑΥʔϚοτͰ৘ใΛ఻͑Δ 2 ʮϦʔμϒϧίʔυʯDustin Boswell, Trevor Foucher, 2012 P10 15

Slide 16

Slide 16 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶃ ໌֬ͳ୯ޠΛબͿ 4 ❌ HogeStorage.set(fuga) ⭕ HogeStorage.store(fuga) 4 ❌ RxSwift.Observable ⭕ RxSwift.Single as you can! 16

Slide 17

Slide 17 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶃ ໌֬ͳ୯ޠΛબͿ ❌ employees.remove(x) view.dismiss(false) let text = words.split(12) ⭕ employees.remove(at: x) view.dismiss(animated: false) let text = words.split(maxSplits: 12) 17

Slide 18

Slide 18 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶄ ൚༻తͳ໊લΛආ͚Δ ʢ͋Δ͍͸ɺ࢖͏ঢ়گΛબͿʣ ❌ final class HogeViewController { private let margin: CGFloat = 2.0 private let defaultSize = CGSize(width: 100, height: 50) ... } !ԿͷϚʔδϯͱαΠζ΍ͶΜ 18

Slide 19

Slide 19 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶄ ൚༻తͳ໊લΛආ͚Δ ʢ͋Δ͍͸ɺ࢖͏ঢ়گΛબͿʣ ⭕ func calculateComponentWidth (paralleling contentSizes: [CGSize]) -> CGFloat { return contentSizes.reduce(margin) { result, size in let margin: CGFloat = 2 result + size.width + margin } } !Ͱ΋͜ΕͳΒڐͤΔɻείʔϓ͕ڱ͍ͷͰɻ 19

Slide 20

Slide 20 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶄ ൚༻తͳ໊લΛආ͚Δ ʢ͋Δ͍͸ɺ࢖͏ঢ়گΛબͿʣ ⭕ var userID: Int? { switch self.userState { case .id(id): return id case .entity(e): return e.id case .unavailable: return nil } } ͋͑ͯࡶͳ໊લΛ͚ͭͯʮҰ࣌తͳ΋ͷʯͩͱࣔ͢ 20

Slide 21

Slide 21 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶅ ந৅తͳ໊લΑΓ΋ ۩ମతͳ໊લΛ࢖͏ ❌ class HogeListViewController : UIViewController { ... func fetch() func fetchBackground() func fetchReally(_ id: String, show: Bool) ... } ͲΕ͕Ͳ͏͍͏໾ׂʁ! 21

Slide 22

Slide 22 text

class HogeListViewController : UIViewController { /// ௨৴ͯ͠ɺࣦഊͨ͠ΒΞϥʔτΛදࣔ͢Δ func fetch() { fetchReally(textField.text!, show: true) } /// ௨৴ͯ͠ɺࣦഊͯ͠΋Ξϥʔτ͸දࣔ͠ͳ͍ func fetchBackground() { fetchReally(textField.text!, show: false) // !Ͳ͏΍ΒʮΞϥʔτΛදࣔ͠ͳ͍ʯ͔Βbackgroundͱ͍͏Β͍͠ɻӕͩΖ!? } func fetchReally(_ id: String, show: Bool) { api.fetch(id) { [weak self] models in self?.didReceive(models: models, showsAlertIfFailed: show) } // !ʮ۩ମతͳ௨৴ॲཧ͕ॻ͍ͯ͋Δʯ͔Βreallyͱ͍͏Β͍͠ } } 22

Slide 23

Slide 23 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶅ ந৅తͳ໊લΑΓ΋ ۩ମతͳ໊લΛ࢖͏ ❌ func fetch() func fetchBackground() func fetchReally(_ id: String, show: Bool) ⭕ func startFetchingHogesWithFailureAlert() func startFetchingHogesWithoutFailureAlert() func fetchHoges(withID id: String, showsAlertIfFailed: Bool) 23

Slide 24

Slide 24 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶆ ઀ඌࣙ΍઀಄ࣙΛ࢖ͬͯ ৘ใΛ௥Ճ͢Δ ❌ let text1 = "100%25%E5%8B%87%E6%B0%97" let text2 = text1.removingPercentEncoding! // "100%༐ؾ" let text3 = text2.removingPercentEncoding! // CRASH" ⭕ let encodedText = "100%25%E5%8B%87%E6%B0%97" let decodedText = encodedText.removingPercentEncoding! // "100%༐ؾ" // ΋͏$͸decodeࡁΈͩͱΘ͔Δ 24

Slide 25

Slide 25 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶇ ໊લͷ௕͞ΛܾΊΔ ௕໊͍લͷೖྗࣗମ͸໰୊͡Όͳ͍ɻίʔυิ׬͕͋ Δ͔Βɻ !লུܗʢbackend→beͱ͔ʣ͸఻ΘΒͳ͍͔Βආ͚Δɻ 25

Slide 26

Slide 26 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉ¥ʯᶇ ໊લͷ௕͞ΛܾΊΔ Ͱ΋ɺෆཁͳ୯ޠ͸౤ࣺ͛ͯΔɻʢSwift3 ͸౤ࣺ͛ͯࡇΓͰͨ͠Ͷʂʣ 26

Slide 27

Slide 27 text

ʮ໊લʹ৘ใΛ٧ΊࠐΉʯᶈ ໊લͷϑΥʔϚοτͰ৘ใΛ఻͑Δ SwiftͰݴ͑͹… 4 େจࣈ࢝·Γ͸ܕ໊ɺͦΕҎ֎͸খจࣈ࢝·Γ 4 ΞϯμʔείΞ࢝·ΓͷAPI͸publicͳ΋ͷͰ ͸ͳ͍ ྫ: _kvcKeyPathString ໰୊ https://bugs.swift.org/browse/SR-5220 27

Slide 28

Slide 28 text

Ҏ্͕ʮ໊લʹ৘ใΛ٧ΊࠐΉʯ Ͱͨ͠ 1. ໌֬ͳ୯ޠΛબͿ 2. ൚༻తͳ໊લΛආ͚Δʢ͋Δ͍͸ɺ࢖͏ঢ়گΛબͿʣ 3. ந৅తͳ໊લΑΓ΋۩ମతͳ໊લΛ࢖͏ 4. ઀ඌࣙ΍઀಄ࣙΛ࢖ͬͯ৘ใΛ௥Ճ͢Δ 5. ໊લͷ௕͞ΛܾΊΔ 6. ໊લͷϑΥʔϚοτͰ৘ใΛ఻͑Δ 28

Slide 29

Slide 29 text

ʮϦϑΝΫλϦϯάʯ ΋͍͍͜ͱݴͬͯͨ "ϝιου໊ʹ͸ɺ಺෦ͰͲͷ Α͏ʹॲཧΛ͍ͯ͠Δ͔Ͱͳ ͘ɺͦͷίʔυ͕ԿΛ͢Δͷ ͔ͱ͍͏ҙਤΛࣔ͠·͢ɻ"4 4 ʮ৽૷൛ɹϦϑΝΫλϦϯάɹطଘͷίʔυΛ҆શ ʹվળ͢Δʯ2014೥ P77 29

Slide 30

Slide 30 text

Swift ͷ API design guideline ʹै͏ https://swift.org/documentation/api-design-guidelines/#naming 4 ྲྀெͳӳจʹݟ͑ΔΑ͏ʹ 4 ม਺ɾҾ਺ɾ෇ଐܕͷωʔϛϯά͸ɺͦͷ੍໿ΑΓ΋໾ׂʹԠͯ͡ߦ͏ 4 ϝιου໊ͷ඼ࢺΛɺ෭࡞༻͋Δͳ͠ͰมԽͤ͞Δ 4 ෭࡞༻ͳ͠: ໊ࢺɺಈࢺͷաڈ෼ࢺɺݱࡏ෼ࢺΛ࢖͏ 4 e.g. array.sorted 4 ෭࡞༻͋Γ: ಈࢺͷ໋ྩܗΛ࢖͏ɻ͋Δ͍͸ form Λ಄ʹ͚ͭΔ 4 e.g. array.sort ɹ/ɹ y.formUnion() 4 લྫΛ࠾༻͠·͠ΐ͏ 4 etc... 30

Slide 31

Slide 31 text

Swift Foundation / Cocoaͷྲّྀʹ ै͏ API design guidelineͷ "લྫΛ࠾༻͠·͠ΐ͏" Λ࠾༻͠·͠ΐ͏ 4 Bool ܕ ͸ isʙ ɺcanʙ ɺneedsʙ ͳͲͰ࢝·Δ 4 delegate ϝιουͷ໊෇͚ํ 4 ❌ func willBlog(_ blog: Blog) ⭕ func atendeeWillBlog(_ blog: Blog) 4 APIΛશମݕࡧͰ͖ΔΑ͏ʹ͓ͯ͘͠ͱศར 4 https://developer.apple.com/search/?q={query} &type=Reference 31

Slide 32

Slide 32 text

ͦ΋ͦ΋ ద੾ͳωʔϛϯά͕ Ͱ͖ͳ͍ྫ΋͋Δ 32

Slide 33

Slide 33 text

class HogeListViewController : UIViewController { ... func startFetchingHogesWithFailureAlert() { fetchHoges(withID: textField.text!, showsAlertIfFailed: true) } func startFetchingHogesWithoutFailureAlert() { fetchHoges(withID: textField.text!, showsAlertIfFailed: false) } func fetchHoges(withID id: String, showsAlertIfFailed: Bool) { api.fetchHoges(withID: id) { [weak self] hoges in self?.didReceive( hoges: hoges, showsAlertIfFailed: showsAlertIfFailed ) } } ... } 33

Slide 34

Slide 34 text

ద੾ͳωʔϛϯά͕Ͱ͖ͳ͍ྫᶃ ඇಉظॲཧ func fetchHoges(withID id: String, showsAlertIfFailed: Bool) { api.fetchHoges(withID: id) { [weak self] hoges in self?.didReceive( hoges: hoges, showsAlertIfFailed: showsAlertIfFailed ) } } !fetchޙͷ׬ྃॲཧ΋୲͍ͬͯΔΜ͔ͩΒɺ ɹfetch ͬͯϝιου໊͚ͩͰ͸͓͔͘͠ͳ͍ʁ 34

Slide 35

Slide 35 text

ߏ଄Խϓϩάϥϛϯάͷେݪଇ ϝιου͸ ೖޱ(Ҿ਺) ͱ ग़ޱ(໭Γ஋) Λ࣋ͭ ͔͠͠ඇಉظॲཧͷ݁Ռ͸ ໭Γ஋ ʹ൓ө͞Εͳ͍ 35

Slide 36

Slide 36 text

Ҿ਺͔໭Γ஋Ͱ ඇಉظॲཧ݁ՌΛड͚ΒΕΔ σβΠϯύλʔϯΛ࢖͓͏ 36

Slide 37

Slide 37 text

ద੾ͳωʔϛϯά͕Ͱ͖ͳ͍ྫᶃ ඇಉظॲཧ ඇಉظॲཧ͸ callback ΍ Promiseύλʔϯ Λ࢖ͬͯ Α͏΍͘ਖ਼͘͠ݴ͍දͤΔ ! func fetchHoges(withID id: String, showsAlertIfFailed: Bool) "callback func fetchHoges(withID id: String, completion: ([Hoge] -> Void)) #promise func fetchHoges(withID id: String) -> RxSwift.Single<[Hoge]> 37

Slide 38

Slide 38 text

ద੾ͳωʔϛϯά͕Ͱ͖ͳ͍ྫᶄ ʁʁʁʁʁʁʁʁʁ func postProfileWith(name: String?, address: String?, tel: String?, profileImage: UIImage?, profileImageURL: URL?) -> RxSwift.Single γϯϓϧͰ෼͔Γ΍͍͢ϝιου໊… 38

Slide 39

Slide 39 text

ద੾ͳωʔϛϯά͕Ͱ͖ͳ͍ྫᶄ ʁʁʁʁʁʁʁʁʁ func postProfileWith(name: String?, address: String?, tel: String?, profileImage: UIImage?, profileImageURL: URL?) -> RxSwift.Single γϯϓϧͰ෼͔Γ΍͍͢ϝιου໊… ͬͯɺຊ౰ʁ 39

Slide 40

Slide 40 text

ద੾ͳωʔϛϯά͕Ͱ͖ͳ͍ྫᶄ Ҿ਺ͷදݱྗ͕ऑ͍ func postProfileWith(name: String?, address: String?, tel: String?, profileImage: UIImage?, profileImageURL: URL?) -> RxSwift.Single 4 Optional͹͔Γ͚ͩͲɺඞਢύϥϝʔλ͸Կͳͷ͔ 4 tel ☎ ͸Ͳ͏͍͏ϑΥʔϚοτͰจࣈྻԽ͢Ε͹͍͍ͷ͔ 4 Կނ profileImage ͱ profileImageURL ͕྆ํ͋Δͷ͔ɻͲͪ Β΋౉ͨ͠Βɺ͋Δ͍͸ͲͪΒ΋౉͞ͳ͔ͬͨΒͲ͏ͳΔͷ͔ɻ 40

Slide 41

Slide 41 text

Ҿ਺΋ωʔϛϯάͷ಺ (໭Γ஋΋) 41

Slide 42

Slide 42 text

Ҿ਺ͷදݱྗΛߴΊΔ func postProfileWith(name: String?, address: String?, tel: String?, profileImage: UIImage?, profileImageURL: URL?) -> RxSwift.Single ɹɹɹɹɹɹɹɹɹɹɹɹɹɹɹ! func postProfileWith(textData: ProfileTextData?, imageData: ProfileImageData) -> RxSwift.Single 42

Slide 43

Slide 43 text

// ͢΂ͯͷཁૉ͕ඞཁͳ৔߹ (AND) ͸ struct ͰදݱͰ͖Δ struct ProfileTextData { let name: String let address: String let tel: Tel? } // ͍ͣΕ͔ͷཁૉ͕ඞཁͳ৔߹ (OR) ͸ enum ͰදݱͰ͖Δ enum ProfileImageData { case image(UIImage) case url(URL) } 43

Slide 44

Slide 44 text

Ҿ਺ͷදݱྗΛߴΊΔ func postProfileWith(textData: ProfileTextData?, imageData: ProfileImageData) -> RxSwift.Single 4 ProfileTextData (name & address & tel?) ͸ 4 ἧ͑ͯ౉͢ or ׬શεϧʔ 4 ProfileImageData (UIImage | URL) ͸ 4 ͍ͣΕ͔Λ౉͢ ͳΔ΄Ͳʂ! 44

Slide 45

Slide 45 text

ద੾ͳ໊લΛߟ͑Δ ⊃ ઃܭͷݟ௚͠ 45

Slide 46

Slide 46 text

= ϦϑΝΫλϦϯά 46

Slide 47

Slide 47 text

ਖ਼໊͘͠෇͚Α͏ͱ͢Δͱ ϝιουͷ໊લ͕ ΍ͨΒ௕͔ͬͨΓ΅Μ΍Γ͢Δ! →❌ ෆਖ਼֬Ͱ΋ ୹͘ཁ໿ͪ͠Ό͓͏" 47

Slide 48

Slide 48 text

ਖ਼໊͘͠෇͚Α͏ͱ͢Δͱ ϝιουͷ໊લ͕ ΍ͨΒ௕͔ͬͨΓ΅Μ΍Γ͢Δ! →⭕ ϝιουͷ໾ׂ͕େ͖͗͢ ͭ·ΓϦϑΝΫλϦϯά͕ ඞཁͩͱ͍͏αΠϯͩʂ" 48

Slide 49

Slide 49 text

ʮϝιουΦϒδΣΫτʯ ϝιουࣗ਎ → ໊ࢺԽͯ͠ܕ(ΦϒδΣΫτ) ʹ શͯͷϩʔΧϧม਺ → ܕͷϓϩύςΟ ʹ ϝιου → ܕ಺ͷϝιου܈ ʹ class ProfilePoster { let textData: ProfileTextData? let imageData: ProfileImageData func run() -> RxSwift.Single private func ... } 49

Slide 50

Slide 50 text

ʮಛੑͷԣ࿀ูʯ ʢ͋Δϝιου͕ɺࣗ෼ͷΫϥεΑΓ΋ଞͷΫϥεʹڵຯΛ࣋ͭʯঢ়ଶʣ ❌ class ProfilePoster { ... private func isTelValid(tel: String) -> Bool { return (try! NSRegularExpression(pattern: "^[0-9]+-[0-9]+-[0-9]+$")) .firstMatch(in: tel, range: NSRange( location: 0, length: (tel as NSString).length )) != nil } } ※isTelValid(tel:) ͷڵຯ͸ ʮϓϩϑΟʔϧͷฤूը໘ʯͰ͸ͳ͘ʮ☎ి࿩൪߸ʯ 50

Slide 51

Slide 51 text

ʮಛੑͷԣ࿀ูʯ ʢ͋Δϝιου͕ɺࣗ෼ͷΫϥεΑΓ΋ଞͷΫϥεʹڵຯΛ࣋ͭʯঢ়ଶʣ ☎͕ڵຯͷத৺Ͱ͋ΔܕΛ࡞Γɺ isTelValid(tel:) ΛҠಈ ⭕ struct Tel { let value: String var isValid: Bool { return try! value.matches(pattern: "^[0-9]+-[0-9]+-[0-9]+$") // ※ String.matches(pattern:) ͸ String ʹੜ΍ͨ͠ extension } } 51

Slide 52

Slide 52 text

ओޠͱͳΔܕʹॲཧΛୗ͢͜ͱͰɺ ໌ྎ؆ܿͳωʔϛϯάʹͳΔ !before! ProfilePoster.isTelValid(tel: String) -> Bool "after" Tel.isValid: Bool 4 ॲཧର৅͕selfͱͳΔ 4 ϝιουج෦ʹॻ͍͍ͯͨॲཧର৅Λɺܕࣗ਎͕આ໌ͯ͘͠Ε Δ 4 ॲཧର৅Λ͋ΒΘ͢Ҿ਺΋ফ͑Δ 52

Slide 53

Slide 53 text

ͪͳΈʹ Tel.isValid: Bool ΑΓ΋ྑ͍ઃܭ: init࣌ʹόϦσʔτͯ͠ɺͦ΋ͦ΋ෆਖ਼ͳ Tel ܕ Λ࡞Εͳ͍Α͏ʹ͢Δ struct Tel { enum Error: Swift.Error { case invalidFormat } let value: String init(value: String) throws { guard try value.matches(pattern: "^[0-9]+-[0-9]+-[0-9]+$") else { throw Error.invalidFormat } self.value = value } } 53

Slide 54

Slide 54 text

ܕ ʹඋΘΔදݱྗ! 54

Slide 55

Slide 55 text

ΦϒδΣΫτࢦ޲Ͱॻ͘ݶΓ ϝιου΋ϓϩύςΟ΋ ԿΒ͔ͷܕͷ ϝϯό 55

Slide 56

Slide 56 text

ΑΓྑ͍ωʔϛϯάͷͨΊʹ͸ "ԿΛ͢Δ/ԿͰ͋Δ" ͚ͩͰͳ͘ "୭͕/୭ͷ" Λҙࣝ͢Δ 56

Slide 57

Slide 57 text

Happy Naming!! 57

Slide 58

Slide 58 text

͓·͚ ΑΓ๛͔ͳ ωʔϛϯάͷͨΊʹ 58

Slide 59

Slide 59 text

returns Optional vs throws struct Tel { enum Error: Swift.Error { case invalidFormat } let value: String ! init(value: String) throws { guard try value.matches(pattern: "^[0-9]+-[0-9]+-[0-9]+$") else { throw Error.invalidFormat } self.value = value } } init?(value: String) ͱ͍͏ख΋͋Δ͚Ͳ…ʁ 59

Slide 60

Slide 60 text

returns Optional vs throws returns Optional 4 ! ͓खܰ؆୯ʹѻ͑Δ 4 " ෇Ճ৘ใ͕๡͍͠ ྫ֎ॲཧ(throws) 4 !ʮࣦഊ͠͏Δʯ͜ͱΛ໌֬ʹදͤΔ 4 ! try? ߏจͰOptionalʹม׵Մೳ 4 ! Error Λఆٛͯ͠ࡉ΍͔ʹࣦഊݪҼΛ఻͑ΒΕΔ 4 " Error Λఆٛ͢Δඞཁ͕͋Δ 60

Slide 61

Slide 61 text

ݴޠػೳΛۦ࢖͠Α͏ 4 ࣗ෼ࣗ਎ͷܕΛฦ͢static func 4 operator 4 ه߸ʹΑΔॲཧΛఆٛ͢Δ 4 લஔɾதஔɾޙஔ 4 subscript 4 e.g.ɹ reversiBoard[x: 10, y: 8] 4 ෳ਺ͷҾ਺ɺϥϕϧ෇༩΋Մೳ 61

Slide 62

Slide 62 text

ίϚϯυɾΫΤϦ෼཭ݪଇ (CQRS) 4 ίϚϯυʢ໭Γ஋ͳ͠ɺ෭࡞༻Λى͜͢ʣ 4 ΫΤϦʢ໭Γ஋Λظ଴ɺԿ౓ݺΜͰ΋ಉ݁͡Ռ(ႈ ౳)ʣ Λ෼͚Δͱઃܭ͕͖ͬ͢Γ͢ΔΑͱ͍͏࿩ var canFetch: Bool func startFetching(id: Int) -> Void let hoges: Rx.Observable<[Hoge]> 62

Slide 63

Slide 63 text

Happy Happy Naming!! 63