美文网首页
Swift 类方法

Swift 类方法

作者: 山杨 | 来源:发表于2023-11-19 20:38 被阅读0次
class SomeClass {
    class func someTypeMethod() {
        // 在这里实现类型方法
    }
    // 类型属性(与静态属性类似)
    class var theURL: URL? {
        return URL(string: "https://www.cnnnd.com")
    }
    // 静态属性
    static var theStValue: URL? = URL(string: "https://www.cnnnd.com")
}

相关文章

网友评论

      本文标题:Swift 类方法

      本文链接:https://www.haomeiwen.com/subject/pppmwdtx.html