swift-framework的合并

swift framework如何支持合并呢?以YKBaseFramework.framework为例。 1.lipo合并静态库。 1 lipo -create Release-iphoneos/YKBaseFramework.framework/YKBaseFramework Debug-iphonesimulator/YKBaseFramework.framework/YKBaseFramework -output YKBaseFramework 生成YK

takeUnretainedValue与takeRetainedValue区别

1. perform时警告 swift中,如果我们使用perform相关函数时,例如 1 2 3 4 if let object = connectionItem.perform(connectionSEL, with: nil) { (object as! YKURLConnection).cancel() } 此时会报警告 Cast from 'Unmanaged<AnyObject>' to unrelated type 'YKURLConnection' always fails

swift-散列算法md5

md5算法 swift中散列算法md5很常用。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 func md5() -> NSString { guard self.length > 0 else { return self } let utf8Buf = self.cString(using: String.Encoding.utf8.rawValue) let length = self.lengthOfBytes(using: String.Encoding.utf8.rawValue)

swift之url编解码

url的编码与解码,在工程中很常用,编解码针对特殊字符及中文,确保url可以正常访问 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 let KUrlCodingReservedCharacters = "!*'();:|@&=+$,/?%#[]{}" extension NSString { ///

swift之gzip解压缩(一)-Data

解压缩使用swift需要引用libz库 一.声明Data类的扩展 1 2 3 4 5 6 /**解压缩流大小**/ private let GZIP_STREAM_SIZE: Int32 = Int32(MemoryLayout<z_stream>.size) /**解压缩缓冲区大小**/ private

iOS指针集合类

Collections之Pointer Collections :指针集合类 NSPointerArray NSHashTable NSMapTable 1.NSPointerFunctionsOptionsDefines the memory and personality options for an NSPointerFunctions object. NSPointerFunctionsMachVirtualMemory NSPointerFunctionsMallocMemory Use free() on removal, calloc() on copy in. NSPointerFunctionsOpaqueMemory NSPointerFunctionsStrongMemory NSPointerFunctionsWeakMemory Uses weak read and write barriers appropriate for ARC or GC. Using NSPointerFunctionsWeakMemory object references will turn to