wantedly / ios_night

Let's talk about iOS development -- iOS Night 📱🌙 You might apply to this meetup from
https://www.wantedly.com/companies/wantedly/projects
18 stars 0 forks source link

2019/08/20 19:30~20:30 #63

Closed ShotaKashihara closed 4 years ago

ShotaKashihara commented 4 years ago

Why

Where

Pearl Jam (Subject to change)

5F, MG Shirokanedai Building (Wantedly, Inc. Tokyo HQ)

Who

You are working for Wantedly? Sure, you can join anytime. If not, you need to contact us first. Or, you can "want to visit" the meetup, which you can find in www.wantedly.com/companies/wantedly/projects.

What

You write topics like below contents and we talk about these on the meetup. Every participant needs to write one topic at least.

Also, you can find new topics from the newsletters:

How

         ・・・

参加者は開催までに話したいことを少なくとも1トピックをコメントしましょう。 ネタ被りを避けるために、まずはタイトルだけでコメントすることを推奨します。 より多くの学びを得るためにどんな内容でもアウトプットを歓迎します!😊

cc/ @wantedly/ios

Edit this template

Previous issue

https://github.com/wantedly/ios_night/issues/62

jiro commented 4 years ago

今日は @nowperson も参加します!

jiro commented 4 years ago

22 short tests of Combine – Part 1: Protocols

https://www.cocoawithlove.com/blog/twenty-two-short-tests-of-combine-part-1.html

他のリアクティブプログラミングフレームワークを利用した際に問題になるエッジケースをCombineフレームワークがどのように扱っているかを調べた結果

テストケース https://github.com/mattgallagher/CombineExploration/blob/master/Tests/CombineExplorationTests/ProtocolTests.swift

利用しているextension https://github.com/mattgallagher/CombineExploration/blob/master/Sources/CombineExploration/Subject%2BSend.swift https://github.com/mattgallagher/CombineExploration/blob/master/Sources/CombineExploration/Subscribers%2BEvent.swift

ngtk commented 4 years ago

Error handling in Combine explained with code examples

https://www.avanderlee.com/swift/combine-error-handling/

Mapping errors using mapError

mapErrorで上がったErrorから適切なErrorにマップできる。

let cancellable = imageURLPublisher.flatMap { requestURL in
    return URLSession.shared.dataTaskPublisher(for: requestURL)
        .mapError { error -> RequestError in
            return RequestError.sessionError(error: error)
        }
}.sink(receiveCompletion: { (error) in
    print("Image request failed: \(String(describing: error))")
}, receiveValue: { (result) in
    let image = UIImage(data: result.data)
})

// Fetches the image successfully.
imageURLPublisher.send(URL(string: "https://httpbin.org/image/jpeg")!)

// Prints: Image request failed: RequestError.sessionError(error: Error Domain=NSURLErrorDomain Code=-1003 "A server with the specified hostname could not be found."
imageURLPublisher.send(URL(string: "https://unknown.url/image")!)

let notFoundImage: UIImage? = UIImage()
let imageURLPublisher = PassthroughSubject<URL, RequestError>()
let cancellable = imageURLPublisher.flatMap { requestURL in
    return URLSession.shared.dataTaskPublisher(for: requestURL)
        .mapError { error -> RequestError in
            return RequestError.sessionError(error: error)
        }
}.map({ (result) -> UIImage? in
    return UIImage(data: result.data)
}).catch({ (error) -> Just<UIImage?> in
    return Just(notFoundImage)
}).sink(receiveValue: { (image) in
    _ = image
})

imageURLPublisher.send(URL(string: "https://httpbin.org/image/jpeg")!)
ShotaKashihara commented 4 years ago

Cosmo/HackMan

https://github.com/Cosmo/HackMan

Sourcery みたいなボイラーテンプレート生成ツール

ShotaKashihara commented 4 years ago

Property Wrappers の Example

@propertyWrapper を使った自作 PropertyWrapper の例

https://github.com/apple/swift-evolution/blob/master/proposals/0258-property-wrappers.md#examples

hiranodept commented 4 years ago

SwiftUI でcollectionView

https://github.com/Q-Mobile/QGrid

QGridDemo

takashings commented 4 years ago

UIRefreshControl in UIScrollView

https://developer.apple.com/documentation/uikit/uiscrollview/2127691-refreshcontrol