churabou / iOS-develop-blog

0 stars 0 forks source link

遊び #32

Open churabou opened 6 years ago

churabou commented 6 years ago

日本語でも補完出るようになってた

class クラス {

    var プロパティー = ""

    func メソッド(第一引数の数値: Int, 第二引数の文字列: String) {

    }
}

let インスタンス = クラス()
インスタンス.プロパティー = "書き換える"
インスタンス.メソッド(第一引数の数値: 0, 第二引数の文字列: "string")
churabou commented 6 years ago

Snapkitのソースが普通すぎた

protocol IntStringUIView {
}

extension Int: IntStringUIView {
}

extension String: IntStringUIView {
}

extension UIView: IntStringUIView {
}

func gudge(_ t: IntStringUIView) {

    if let int = t as? Int {
        print(int)
    }

    if let str = t as? String {
        print(str)
    }

    if let view = t as? UIView {
        print(view)
    }
}