随笔分类 -  swift

上一页 1 ··· 3 4 5 6 7 8 下一页
摘要:在泛型T.Type中,T.Type类型的参量只是泛型初始化的一环,传入的参量理论上只负责泛型的类型的确定。 类型:swift中的类型通过.self获取。 阅读全文
posted @ 2018-06-13 17:16 zzfx 阅读(132) 评论(0) 推荐(0)
摘要:It is used to create an alias name for another data type. The syntax of the typedef declaration is:[2] In Swift, typedef is called typealias: typealia 阅读全文
posted @ 2018-06-11 18:34 zzfx 阅读(136) 评论(0) 推荐(0)
摘要:计算属性每次都重新计算。 懒加载只计算一次。 可以借助backing store将计算属性转化为懒加载属性。 计算属性实质上退化为函数调用。 计算属性的标示是get、set。 阅读全文
posted @ 2018-06-06 16:28 zzfx 阅读(396) 评论(0) 推荐(0)
摘要:只是一种语法和逻辑上的优化 阅读全文
posted @ 2018-06-06 15:27 zzfx 阅读(139) 评论(0) 推荐(0)
摘要:oc的懒加载依赖于属性的双重属性的函数属性部分。 懒加载的本质是执行get函数。 swift的lazy,理论上与此类似。 编译器优化时可能对初始化块进行了保存。 懒加载的本质是延迟执行。 只要是执行,必定有调用; 只要有延迟,必然有保存。 #pragma mark - getter // 导航栏 / 阅读全文
posted @ 2018-06-06 14:23 zzfx 阅读(381) 评论(0) 推荐(0)
摘要:第一次使用的时候进行计算和初始化,后面的引用不在进行计算。 A lazy stored property is a property whose initial value is not calculated until the first time it is used. You indicate 阅读全文
posted @ 2018-06-05 19:44 zzfx 阅读(124) 评论(0) 推荐(0)
摘要:在Objective-C中,苹果并没有提供JSON转模型(模型转JSON)的接口,往往在开中需要添加第三库来处理JSON数据,比如:JsonModel、MJExtension、Mantle、JsonKit等,想了解更多这些库,可以去看一下这篇文章 iOS中JSON解析三方库的比较。 在Swfit中从 阅读全文
posted @ 2018-05-30 11:47 zzfx 阅读(983) 评论(0) 推荐(0)
摘要:元类型是指所有类型的类型。 元类型只能类型出现在类型标示位; 类型即能作为类型存在,出现在类型标示位; 也能作为变量存在,出现在元类型的变量位。 http://www.swift51.com/swift2.0/chapter3/03_Types.html#type_inheritance_claus 阅读全文
posted @ 2018-05-29 18:31 zzfx 阅读(351) 评论(0) 推荐(0)
摘要:type(of:) Applied to an object: the polymorphic (internal) type of the object, regardless of how a reference is typed. Static/class members are access 阅读全文
posted @ 2018-05-29 17:55 zzfx 阅读(136) 评论(0) 推荐(0)
摘要:类型与变量中的类型。只要有变量就可能有泛型的存在。 泛型是在确定类型的结构和函数基础上进行的二次抽象。目的是达到高代码可用。 是针对结构和函数中的类型进行的二次抽象。 算法和结构中的类型(可变)待定。 泛型:泛指类型、待定类型、不确定类型。与变量密切相关。 泛型,即“参数化类型”。--参数:自变量 阅读全文
posted @ 2018-05-29 14:49 zzfx 阅读(295) 评论(0) 推荐(0)
摘要:In swift 3 and above (or !==) Checks if the values are identical (both point to the same memory address). Comparing reference types. Like == in Obj-C 阅读全文
posted @ 2018-05-29 11:27 zzfx 阅读(193) 评论(0) 推荐(0)
摘要:Swift is a type-safe language. A type safe language encourages you to be clear about the types of values your code can work with. If part of your code 阅读全文
posted @ 2018-05-28 23:08 zzfx 阅读(164) 评论(0) 推荐(0)
摘要:Typealias Typealias typealias 是用来为已经存在的类型重新定义名字的,通过命名,可以使代码变得更加清晰。使用的语法也很简单,使用typealias 关键字像使用普通的赋值语句一样,可以将某个已经存在的类型赋值为新的名字。比如在计算二维平面上的距离和位置的时候,我们一般使用 阅读全文
posted @ 2018-05-28 22:43 zzfx 阅读(4039) 评论(0) 推荐(0)
摘要:原文: Method Dispatch in Swift作者: Brain King译者: kemchenj 译者注: 之前看了很多关于 Swift 派发机制的内容, 但感觉没有一篇能够彻底讲清楚这件事情, 看完了这篇文章之后我对 Swift 的派发机制才建立起了初步的认知. 正文 一张表总结引用类 阅读全文
posted @ 2018-05-26 23:07 zzfx 阅读(1025) 评论(0) 推荐(0)
摘要:Self相当于oc中的instance 是什么 相信大家都知道self这个关键字的具体作用,它跟OC里的self基本一样。但是对于Self来说...(WTF,这是什么东西) 当你用错Self的时候编译器会这样提示 'Self' is only available in a protocol or a 阅读全文
posted @ 2018-05-26 11:34 zzfx 阅读(617) 评论(0) 推荐(0)
摘要:Postfix Self Expression A postfix self expression consists of an expression or the name of a type, immediately followed by .self. It has the following 阅读全文
posted @ 2018-05-26 11:27 zzfx 阅读(238) 评论(0) 推荐(0)
摘要:dynamic Apply this modifier to any member of a class that can be represented by Objective-C. When you mark a member declaration with the dynamic modif 阅读全文
posted @ 2018-05-24 19:46 zzfx 阅读(1979) 评论(0) 推荐(0)
摘要:You write an in-out parameter by placing the inout keyword right before a parameter’s type. An in-out parameter has a value that is passed in to the f 阅读全文
posted @ 2018-05-23 19:09 zzfx 阅读(326) 评论(0) 推荐(0)
摘要:Written by Paul Hudson @twostraws It's very common in iOS to want to create complex objects only when you need them, largely because with limited comp 阅读全文
posted @ 2018-05-16 10:54 zzfx 阅读(170) 评论(0) 推荐(0)
摘要:'Self' is the type of a protocol/class/struct/enum.And the 'self' is a instance of a class/struct/enum.As for your requirement,maybe you could write l 阅读全文
posted @ 2018-05-15 19:26 zzfx 阅读(125) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7 8 下一页