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

2020/02/18 19:30~20:30 #88

Closed jjenko closed 4 years ago

jjenko commented 4 years ago

⚠️ This repository is public. / 公開リポジトリです。

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

Previous issue

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

_Created from https://github.com/wantedly/ios_night/issues/85 by issue-creator_

jiro commented 4 years ago

Thinking in SwiftUI

https://www.objc.io/books/thinking-in-swiftui/ https://www.objc.io/blog/2020/02/03/thinking-in-swiftui/

ShotaKashihara commented 4 years ago

Xcode 11.4 beta Topics

https://qiita.com/shira-shun/items/2c48e145c0872e77b0d5

k-kohey commented 4 years ago

SwiftCheck

Property based testの思想の基に作られたSwiftCheckを使ってみた. テストケースにて,具体的な入力値と期待値は記述せず,テスト対象が満たすべき性質のみを記述する.

使用例 プリミティブ型

func testMaxWithInt() {
        property("xがy以上であった場合にはxを返す.また,yがx以上であった場合にはxを返す.") <- forAll { (x: Int, y: Int) in
            return x >= y ? max(x, y) == x : max(x, y) == y
        }

使用例 カスタムタイプ

カスタプタイプを使う場合は,Arbitraryに準拠させる必要がある. 💡Sourceryで自動的に準拠させたい.

struct ComplexNumber {
    let realPart: Double
    let imaginarryPart: Double

    var size: Double {
        return sqrt(pow(realPart, 2) + pow(imaginarryPart, 2))
    }
}

extension ComplexNumber: CustomStringConvertible {
    var description: String {
        let operatorString = imaginarryPart >= 0 ? "+" : "-"
        return "\(realPart)\(operatorString)j\(abs(imaginarryPart))"
    }
}

extension ComplexNumber: Comparable {
    static func < (lhs: ComplexNumber, rhs: ComplexNumber) -> Bool {
        return lhs.size < rhs.size
    }
}
property("xがy以上でありyがx以上であった場合にはx==y(antisymmetric law)") <- forAll { (x: Int, y: Int) in
            return max(x, y) == x && max(y, x) == y ? x == y : x != y
        }
    }

extension ComplexNumber: Arbitrary {
    public static var arbitrary : Gen<ComplexNumber> {
        return Gen<(Double, Double)>.zip(Double.arbitrary, Double.arbitrary).map(ComplexNumber.init)
    }
}

📝https://paper.dropbox.com/doc/SourcerySwiftCheckArbitrary--AugKRgCdF1Nt~b4jzDa_S4viAQ-84GGQ3TFhoQtE0HnHfe0s

hiranodept commented 4 years ago

Testing push notifications on the iOS simulator

3つの方法

Poesを使う

https://github.com/AvdLee/Poes

$ mint install AvdLee/Poes
$ Poes --bundle-identifier com.wetransfer.app --verbose
Generated payload:

{
  "aps" : {
    "alert" : {
      "title" : "Default title",
      "body" : "Default body"
    },
    "mutable-content" : false
  }
}

Sending push notification...
Push notification sent successfully

command line toolのwrapperで、payload.jsonを作ってくれる

Xcodeのcommand line toolを使う

$ xcrun simctl push booted com.wetransfer.app payload.json 
Notification sent to 'com.wetransfer.app'

APNS fileを使う

sim https://www.avanderlee.com/wp-content/uploads/2020/02/testing_push_notification_apns_file.mp4

APNS fileはpayload.jsonに似ているけど、Simulator Target Bundleが必要

{
    "Simulator Target Bundle": "com.wetransfer.app",
    "aps": {
        "alert": {
            "body": "Gerard added something new - take a look",
            "title": "Photos"
        }
    }
}

ref: https://www.avanderlee.com/workflow/testing-push-notifications-ios-simulator/?utm_campaign=coschedule&utm_source=twitter&utm_medium=twannl&utm_content=Testing%20push%20notifications%20on%20the%20iOS%20simulator

(ちなみに樫原さんはpush通知送る君を作った)