├── CFRuntime.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── CFRuntime.xccheckout │ └── xcuserdata │ │ └── Charlin.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Charlin.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── CFRuntime.xcscheme │ └── xcschememanagement.plist ├── CFRuntime ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── CFRuntime │ ├── CFProperty │ │ ├── CFProperty+Extend.swift │ │ └── CFProperty.swift │ ├── CFPropertyType │ │ ├── CFPropertyType.swift │ │ └── CFPropertyTypeEnum.swift │ ├── CFRunTime │ │ ├── Mirror+Extend.swift │ │ ├── Mirror.swift │ │ └── MirrorItem.swift │ ├── Common │ │ └── CFRuntimeCommon.swift │ └── NSObject │ │ ├── NSNumber+CFRuntime.swift │ │ ├── NSObject+KeyValues.swift │ │ └── NSObject+Mirror.swift ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── Info.plist ├── ViewController.swift ├── show.png └── show2.jpg ├── CFRuntimeTests ├── CFRuntimeTests.swift └── Info.plist └── README.md /CFRuntime.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 894E485F1B50D3090097E0D8 /* NSNumber+CFRuntime.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E485E1B50D3090097E0D8 /* NSNumber+CFRuntime.swift */; }; 11 | 894E48611B50D3F40097E0D8 /* CFProperty+Extend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E48601B50D3F40097E0D8 /* CFProperty+Extend.swift */; }; 12 | 894E48661B5103360097E0D8 /* Mirror.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E48651B5103360097E0D8 /* Mirror.swift */; }; 13 | 894E48681B51035D0097E0D8 /* MirrorItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E48671B51035D0097E0D8 /* MirrorItem.swift */; }; 14 | 894E486A1B5103B70097E0D8 /* Mirror+Extend.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E48691B5103B70097E0D8 /* Mirror+Extend.swift */; }; 15 | 894E486C1B510AA50097E0D8 /* show.png in Resources */ = {isa = PBXBuildFile; fileRef = 894E486B1B510AA50097E0D8 /* show.png */; }; 16 | 89524A8D1B4FE966004A27BB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89524A8C1B4FE966004A27BB /* AppDelegate.swift */; }; 17 | 89524A8F1B4FE966004A27BB /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89524A8E1B4FE966004A27BB /* ViewController.swift */; }; 18 | 89524A921B4FE966004A27BB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 89524A901B4FE966004A27BB /* Main.storyboard */; }; 19 | 89524A941B4FE966004A27BB /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 89524A931B4FE966004A27BB /* Images.xcassets */; }; 20 | 89524A971B4FE966004A27BB /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 89524A951B4FE966004A27BB /* LaunchScreen.xib */; }; 21 | 89524AA31B4FE967004A27BB /* CFRuntimeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89524AA21B4FE967004A27BB /* CFRuntimeTests.swift */; }; 22 | 89524AB61B4FEF6B004A27BB /* NSObject+Mirror.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89524AB51B4FEF6B004A27BB /* NSObject+Mirror.swift */; }; 23 | 89524AEB1B4FF022004A27BB /* CFProperty.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89524AEA1B4FF022004A27BB /* CFProperty.swift */; }; 24 | 89524AEE1B4FF185004A27BB /* CFPropertyType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89524AED1B4FF185004A27BB /* CFPropertyType.swift */; }; 25 | 89524AF11B4FF334004A27BB /* CFRuntimeCommon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89524AF01B4FF334004A27BB /* CFRuntimeCommon.swift */; }; 26 | 89524AF31B500598004A27BB /* CFPropertyTypeEnum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89524AF21B500598004A27BB /* CFPropertyTypeEnum.swift */; }; 27 | 89524AF51B500B79004A27BB /* NSObject+KeyValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89524AF41B500B79004A27BB /* NSObject+KeyValues.swift */; }; 28 | 89E90C211B5343C300434774 /* show2.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 89E90C201B5343C300434774 /* show2.jpg */; }; 29 | /* End PBXBuildFile section */ 30 | 31 | /* Begin PBXContainerItemProxy section */ 32 | 89524A9D1B4FE967004A27BB /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = 89524A7F1B4FE966004A27BB /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = 89524A861B4FE966004A27BB; 37 | remoteInfo = CFRuntime; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | 894E485E1B50D3090097E0D8 /* NSNumber+CFRuntime.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSNumber+CFRuntime.swift"; sourceTree = ""; }; 43 | 894E48601B50D3F40097E0D8 /* CFProperty+Extend.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CFProperty+Extend.swift"; sourceTree = ""; }; 44 | 894E48651B5103360097E0D8 /* Mirror.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mirror.swift; sourceTree = ""; }; 45 | 894E48671B51035D0097E0D8 /* MirrorItem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MirrorItem.swift; sourceTree = ""; }; 46 | 894E48691B5103B70097E0D8 /* Mirror+Extend.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Mirror+Extend.swift"; sourceTree = ""; }; 47 | 894E486B1B510AA50097E0D8 /* show.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = show.png; sourceTree = ""; }; 48 | 89524A871B4FE966004A27BB /* CFRuntime.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CFRuntime.app; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 89524A8B1B4FE966004A27BB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 50 | 89524A8C1B4FE966004A27BB /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 51 | 89524A8E1B4FE966004A27BB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 52 | 89524A911B4FE966004A27BB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 89524A931B4FE966004A27BB /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 54 | 89524A961B4FE966004A27BB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 55 | 89524A9C1B4FE967004A27BB /* CFRuntimeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CFRuntimeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 56 | 89524AA11B4FE967004A27BB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | 89524AA21B4FE967004A27BB /* CFRuntimeTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CFRuntimeTests.swift; sourceTree = ""; }; 58 | 89524AB51B4FEF6B004A27BB /* NSObject+Mirror.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSObject+Mirror.swift"; sourceTree = ""; }; 59 | 89524AEA1B4FF022004A27BB /* CFProperty.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CFProperty.swift; sourceTree = ""; }; 60 | 89524AED1B4FF185004A27BB /* CFPropertyType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CFPropertyType.swift; sourceTree = ""; }; 61 | 89524AF01B4FF334004A27BB /* CFRuntimeCommon.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CFRuntimeCommon.swift; sourceTree = ""; }; 62 | 89524AF21B500598004A27BB /* CFPropertyTypeEnum.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CFPropertyTypeEnum.swift; sourceTree = ""; }; 63 | 89524AF41B500B79004A27BB /* NSObject+KeyValues.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSObject+KeyValues.swift"; sourceTree = ""; }; 64 | 89E90C201B5343C300434774 /* show2.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = show2.jpg; sourceTree = ""; }; 65 | /* End PBXFileReference section */ 66 | 67 | /* Begin PBXFrameworksBuildPhase section */ 68 | 89524A841B4FE966004A27BB /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 89524A991B4FE967004A27BB /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | ); 80 | runOnlyForDeploymentPostprocessing = 0; 81 | }; 82 | /* End PBXFrameworksBuildPhase section */ 83 | 84 | /* Begin PBXGroup section */ 85 | 894E48621B5103080097E0D8 /* CFRunTime */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 894E48651B5103360097E0D8 /* Mirror.swift */, 89 | 894E48691B5103B70097E0D8 /* Mirror+Extend.swift */, 90 | 894E48671B51035D0097E0D8 /* MirrorItem.swift */, 91 | ); 92 | path = CFRunTime; 93 | sourceTree = ""; 94 | }; 95 | 89524A7E1B4FE966004A27BB = { 96 | isa = PBXGroup; 97 | children = ( 98 | 89524A891B4FE966004A27BB /* CFRuntime */, 99 | 89524A9F1B4FE967004A27BB /* CFRuntimeTests */, 100 | 89524A881B4FE966004A27BB /* Products */, 101 | ); 102 | sourceTree = ""; 103 | }; 104 | 89524A881B4FE966004A27BB /* Products */ = { 105 | isa = PBXGroup; 106 | children = ( 107 | 89524A871B4FE966004A27BB /* CFRuntime.app */, 108 | 89524A9C1B4FE967004A27BB /* CFRuntimeTests.xctest */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 89524A891B4FE966004A27BB /* CFRuntime */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 89524AAC1B4FE99F004A27BB /* CFRuntime */, 117 | 89524A8C1B4FE966004A27BB /* AppDelegate.swift */, 118 | 89524A8E1B4FE966004A27BB /* ViewController.swift */, 119 | 89524A901B4FE966004A27BB /* Main.storyboard */, 120 | 89524A931B4FE966004A27BB /* Images.xcassets */, 121 | 89524A951B4FE966004A27BB /* LaunchScreen.xib */, 122 | 89524A8A1B4FE966004A27BB /* Supporting Files */, 123 | ); 124 | path = CFRuntime; 125 | sourceTree = ""; 126 | }; 127 | 89524A8A1B4FE966004A27BB /* Supporting Files */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | 89E90C201B5343C300434774 /* show2.jpg */, 131 | 894E486B1B510AA50097E0D8 /* show.png */, 132 | 89524A8B1B4FE966004A27BB /* Info.plist */, 133 | ); 134 | name = "Supporting Files"; 135 | sourceTree = ""; 136 | }; 137 | 89524A9F1B4FE967004A27BB /* CFRuntimeTests */ = { 138 | isa = PBXGroup; 139 | children = ( 140 | 89524AA21B4FE967004A27BB /* CFRuntimeTests.swift */, 141 | 89524AA01B4FE967004A27BB /* Supporting Files */, 142 | ); 143 | path = CFRuntimeTests; 144 | sourceTree = ""; 145 | }; 146 | 89524AA01B4FE967004A27BB /* Supporting Files */ = { 147 | isa = PBXGroup; 148 | children = ( 149 | 89524AA11B4FE967004A27BB /* Info.plist */, 150 | ); 151 | name = "Supporting Files"; 152 | sourceTree = ""; 153 | }; 154 | 89524AAC1B4FE99F004A27BB /* CFRuntime */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 894E48621B5103080097E0D8 /* CFRunTime */, 158 | 89524AEF1B4FF329004A27BB /* Common */, 159 | 89524AEC1B4FF177004A27BB /* CFPropertyType */, 160 | 89524AE91B4FF013004A27BB /* CFProperty */, 161 | 89524AB41B4FEF5A004A27BB /* NSObject */, 162 | ); 163 | path = CFRuntime; 164 | sourceTree = ""; 165 | }; 166 | 89524AB41B4FEF5A004A27BB /* NSObject */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | 894E485E1B50D3090097E0D8 /* NSNumber+CFRuntime.swift */, 170 | 89524AB51B4FEF6B004A27BB /* NSObject+Mirror.swift */, 171 | 89524AF41B500B79004A27BB /* NSObject+KeyValues.swift */, 172 | ); 173 | path = NSObject; 174 | sourceTree = ""; 175 | }; 176 | 89524AE91B4FF013004A27BB /* CFProperty */ = { 177 | isa = PBXGroup; 178 | children = ( 179 | 89524AEA1B4FF022004A27BB /* CFProperty.swift */, 180 | 894E48601B50D3F40097E0D8 /* CFProperty+Extend.swift */, 181 | ); 182 | path = CFProperty; 183 | sourceTree = ""; 184 | }; 185 | 89524AEC1B4FF177004A27BB /* CFPropertyType */ = { 186 | isa = PBXGroup; 187 | children = ( 188 | 89524AED1B4FF185004A27BB /* CFPropertyType.swift */, 189 | 89524AF21B500598004A27BB /* CFPropertyTypeEnum.swift */, 190 | ); 191 | path = CFPropertyType; 192 | sourceTree = ""; 193 | }; 194 | 89524AEF1B4FF329004A27BB /* Common */ = { 195 | isa = PBXGroup; 196 | children = ( 197 | 89524AF01B4FF334004A27BB /* CFRuntimeCommon.swift */, 198 | ); 199 | path = Common; 200 | sourceTree = ""; 201 | }; 202 | /* End PBXGroup section */ 203 | 204 | /* Begin PBXNativeTarget section */ 205 | 89524A861B4FE966004A27BB /* CFRuntime */ = { 206 | isa = PBXNativeTarget; 207 | buildConfigurationList = 89524AA61B4FE967004A27BB /* Build configuration list for PBXNativeTarget "CFRuntime" */; 208 | buildPhases = ( 209 | 89524A831B4FE966004A27BB /* Sources */, 210 | 89524A841B4FE966004A27BB /* Frameworks */, 211 | 89524A851B4FE966004A27BB /* Resources */, 212 | ); 213 | buildRules = ( 214 | ); 215 | dependencies = ( 216 | ); 217 | name = CFRuntime; 218 | productName = CFRuntime; 219 | productReference = 89524A871B4FE966004A27BB /* CFRuntime.app */; 220 | productType = "com.apple.product-type.application"; 221 | }; 222 | 89524A9B1B4FE967004A27BB /* CFRuntimeTests */ = { 223 | isa = PBXNativeTarget; 224 | buildConfigurationList = 89524AA91B4FE967004A27BB /* Build configuration list for PBXNativeTarget "CFRuntimeTests" */; 225 | buildPhases = ( 226 | 89524A981B4FE967004A27BB /* Sources */, 227 | 89524A991B4FE967004A27BB /* Frameworks */, 228 | 89524A9A1B4FE967004A27BB /* Resources */, 229 | ); 230 | buildRules = ( 231 | ); 232 | dependencies = ( 233 | 89524A9E1B4FE967004A27BB /* PBXTargetDependency */, 234 | ); 235 | name = CFRuntimeTests; 236 | productName = CFRuntimeTests; 237 | productReference = 89524A9C1B4FE967004A27BB /* CFRuntimeTests.xctest */; 238 | productType = "com.apple.product-type.bundle.unit-test"; 239 | }; 240 | /* End PBXNativeTarget section */ 241 | 242 | /* Begin PBXProject section */ 243 | 89524A7F1B4FE966004A27BB /* Project object */ = { 244 | isa = PBXProject; 245 | attributes = { 246 | LastUpgradeCheck = 0630; 247 | ORGANIZATIONNAME = "冯成林"; 248 | TargetAttributes = { 249 | 89524A861B4FE966004A27BB = { 250 | CreatedOnToolsVersion = 6.3; 251 | }; 252 | 89524A9B1B4FE967004A27BB = { 253 | CreatedOnToolsVersion = 6.3; 254 | TestTargetID = 89524A861B4FE966004A27BB; 255 | }; 256 | }; 257 | }; 258 | buildConfigurationList = 89524A821B4FE966004A27BB /* Build configuration list for PBXProject "CFRuntime" */; 259 | compatibilityVersion = "Xcode 3.2"; 260 | developmentRegion = English; 261 | hasScannedForEncodings = 0; 262 | knownRegions = ( 263 | en, 264 | Base, 265 | ); 266 | mainGroup = 89524A7E1B4FE966004A27BB; 267 | productRefGroup = 89524A881B4FE966004A27BB /* Products */; 268 | projectDirPath = ""; 269 | projectRoot = ""; 270 | targets = ( 271 | 89524A861B4FE966004A27BB /* CFRuntime */, 272 | 89524A9B1B4FE967004A27BB /* CFRuntimeTests */, 273 | ); 274 | }; 275 | /* End PBXProject section */ 276 | 277 | /* Begin PBXResourcesBuildPhase section */ 278 | 89524A851B4FE966004A27BB /* Resources */ = { 279 | isa = PBXResourcesBuildPhase; 280 | buildActionMask = 2147483647; 281 | files = ( 282 | 894E486C1B510AA50097E0D8 /* show.png in Resources */, 283 | 89524A921B4FE966004A27BB /* Main.storyboard in Resources */, 284 | 89524A971B4FE966004A27BB /* LaunchScreen.xib in Resources */, 285 | 89524A941B4FE966004A27BB /* Images.xcassets in Resources */, 286 | 89E90C211B5343C300434774 /* show2.jpg in Resources */, 287 | ); 288 | runOnlyForDeploymentPostprocessing = 0; 289 | }; 290 | 89524A9A1B4FE967004A27BB /* Resources */ = { 291 | isa = PBXResourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | ); 295 | runOnlyForDeploymentPostprocessing = 0; 296 | }; 297 | /* End PBXResourcesBuildPhase section */ 298 | 299 | /* Begin PBXSourcesBuildPhase section */ 300 | 89524A831B4FE966004A27BB /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | 894E486A1B5103B70097E0D8 /* Mirror+Extend.swift in Sources */, 305 | 89524AB61B4FEF6B004A27BB /* NSObject+Mirror.swift in Sources */, 306 | 89524AEB1B4FF022004A27BB /* CFProperty.swift in Sources */, 307 | 89524A8F1B4FE966004A27BB /* ViewController.swift in Sources */, 308 | 894E48661B5103360097E0D8 /* Mirror.swift in Sources */, 309 | 89524AEE1B4FF185004A27BB /* CFPropertyType.swift in Sources */, 310 | 89524AF51B500B79004A27BB /* NSObject+KeyValues.swift in Sources */, 311 | 89524AF31B500598004A27BB /* CFPropertyTypeEnum.swift in Sources */, 312 | 894E48611B50D3F40097E0D8 /* CFProperty+Extend.swift in Sources */, 313 | 89524AF11B4FF334004A27BB /* CFRuntimeCommon.swift in Sources */, 314 | 894E48681B51035D0097E0D8 /* MirrorItem.swift in Sources */, 315 | 894E485F1B50D3090097E0D8 /* NSNumber+CFRuntime.swift in Sources */, 316 | 89524A8D1B4FE966004A27BB /* AppDelegate.swift in Sources */, 317 | ); 318 | runOnlyForDeploymentPostprocessing = 0; 319 | }; 320 | 89524A981B4FE967004A27BB /* Sources */ = { 321 | isa = PBXSourcesBuildPhase; 322 | buildActionMask = 2147483647; 323 | files = ( 324 | 89524AA31B4FE967004A27BB /* CFRuntimeTests.swift in Sources */, 325 | ); 326 | runOnlyForDeploymentPostprocessing = 0; 327 | }; 328 | /* End PBXSourcesBuildPhase section */ 329 | 330 | /* Begin PBXTargetDependency section */ 331 | 89524A9E1B4FE967004A27BB /* PBXTargetDependency */ = { 332 | isa = PBXTargetDependency; 333 | target = 89524A861B4FE966004A27BB /* CFRuntime */; 334 | targetProxy = 89524A9D1B4FE967004A27BB /* PBXContainerItemProxy */; 335 | }; 336 | /* End PBXTargetDependency section */ 337 | 338 | /* Begin PBXVariantGroup section */ 339 | 89524A901B4FE966004A27BB /* Main.storyboard */ = { 340 | isa = PBXVariantGroup; 341 | children = ( 342 | 89524A911B4FE966004A27BB /* Base */, 343 | ); 344 | name = Main.storyboard; 345 | sourceTree = ""; 346 | }; 347 | 89524A951B4FE966004A27BB /* LaunchScreen.xib */ = { 348 | isa = PBXVariantGroup; 349 | children = ( 350 | 89524A961B4FE966004A27BB /* Base */, 351 | ); 352 | name = LaunchScreen.xib; 353 | sourceTree = ""; 354 | }; 355 | /* End PBXVariantGroup section */ 356 | 357 | /* Begin XCBuildConfiguration section */ 358 | 89524AA41B4FE967004A27BB /* Debug */ = { 359 | isa = XCBuildConfiguration; 360 | buildSettings = { 361 | ALWAYS_SEARCH_USER_PATHS = NO; 362 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 363 | CLANG_CXX_LIBRARY = "libc++"; 364 | CLANG_ENABLE_MODULES = YES; 365 | CLANG_ENABLE_OBJC_ARC = YES; 366 | CLANG_WARN_BOOL_CONVERSION = YES; 367 | CLANG_WARN_CONSTANT_CONVERSION = YES; 368 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 369 | CLANG_WARN_EMPTY_BODY = YES; 370 | CLANG_WARN_ENUM_CONVERSION = YES; 371 | CLANG_WARN_INT_CONVERSION = YES; 372 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 373 | CLANG_WARN_UNREACHABLE_CODE = YES; 374 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 375 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 376 | COPY_PHASE_STRIP = NO; 377 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 378 | ENABLE_STRICT_OBJC_MSGSEND = YES; 379 | GCC_C_LANGUAGE_STANDARD = gnu99; 380 | GCC_DYNAMIC_NO_PIC = NO; 381 | GCC_NO_COMMON_BLOCKS = YES; 382 | GCC_OPTIMIZATION_LEVEL = 0; 383 | GCC_PREPROCESSOR_DEFINITIONS = ( 384 | "DEBUG=1", 385 | "$(inherited)", 386 | ); 387 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 388 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 389 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 390 | GCC_WARN_UNDECLARED_SELECTOR = YES; 391 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 392 | GCC_WARN_UNUSED_FUNCTION = YES; 393 | GCC_WARN_UNUSED_VARIABLE = YES; 394 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 395 | MTL_ENABLE_DEBUG_INFO = YES; 396 | ONLY_ACTIVE_ARCH = YES; 397 | SDKROOT = iphoneos; 398 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 399 | }; 400 | name = Debug; 401 | }; 402 | 89524AA51B4FE967004A27BB /* Release */ = { 403 | isa = XCBuildConfiguration; 404 | buildSettings = { 405 | ALWAYS_SEARCH_USER_PATHS = NO; 406 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 407 | CLANG_CXX_LIBRARY = "libc++"; 408 | CLANG_ENABLE_MODULES = YES; 409 | CLANG_ENABLE_OBJC_ARC = YES; 410 | CLANG_WARN_BOOL_CONVERSION = YES; 411 | CLANG_WARN_CONSTANT_CONVERSION = YES; 412 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 413 | CLANG_WARN_EMPTY_BODY = YES; 414 | CLANG_WARN_ENUM_CONVERSION = YES; 415 | CLANG_WARN_INT_CONVERSION = YES; 416 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 417 | CLANG_WARN_UNREACHABLE_CODE = YES; 418 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 419 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 420 | COPY_PHASE_STRIP = NO; 421 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 422 | ENABLE_NS_ASSERTIONS = NO; 423 | ENABLE_STRICT_OBJC_MSGSEND = YES; 424 | GCC_C_LANGUAGE_STANDARD = gnu99; 425 | GCC_NO_COMMON_BLOCKS = YES; 426 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 427 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 428 | GCC_WARN_UNDECLARED_SELECTOR = YES; 429 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 430 | GCC_WARN_UNUSED_FUNCTION = YES; 431 | GCC_WARN_UNUSED_VARIABLE = YES; 432 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 433 | MTL_ENABLE_DEBUG_INFO = NO; 434 | SDKROOT = iphoneos; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 89524AA71B4FE967004A27BB /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | buildSettings = { 442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 443 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 444 | INFOPLIST_FILE = CFRuntime/Info.plist; 445 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | }; 449 | name = Debug; 450 | }; 451 | 89524AA81B4FE967004A27BB /* Release */ = { 452 | isa = XCBuildConfiguration; 453 | buildSettings = { 454 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 455 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 456 | INFOPLIST_FILE = CFRuntime/Info.plist; 457 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 458 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 459 | PRODUCT_NAME = "$(TARGET_NAME)"; 460 | }; 461 | name = Release; 462 | }; 463 | 89524AAA1B4FE967004A27BB /* Debug */ = { 464 | isa = XCBuildConfiguration; 465 | buildSettings = { 466 | BUNDLE_LOADER = "$(TEST_HOST)"; 467 | FRAMEWORK_SEARCH_PATHS = ( 468 | "$(SDKROOT)/Developer/Library/Frameworks", 469 | "$(inherited)", 470 | ); 471 | GCC_PREPROCESSOR_DEFINITIONS = ( 472 | "DEBUG=1", 473 | "$(inherited)", 474 | ); 475 | INFOPLIST_FILE = CFRuntimeTests/Info.plist; 476 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 477 | PRODUCT_NAME = "$(TARGET_NAME)"; 478 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CFRuntime.app/CFRuntime"; 479 | }; 480 | name = Debug; 481 | }; 482 | 89524AAB1B4FE967004A27BB /* Release */ = { 483 | isa = XCBuildConfiguration; 484 | buildSettings = { 485 | BUNDLE_LOADER = "$(TEST_HOST)"; 486 | FRAMEWORK_SEARCH_PATHS = ( 487 | "$(SDKROOT)/Developer/Library/Frameworks", 488 | "$(inherited)", 489 | ); 490 | INFOPLIST_FILE = CFRuntimeTests/Info.plist; 491 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 492 | PRODUCT_NAME = "$(TARGET_NAME)"; 493 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/CFRuntime.app/CFRuntime"; 494 | }; 495 | name = Release; 496 | }; 497 | /* End XCBuildConfiguration section */ 498 | 499 | /* Begin XCConfigurationList section */ 500 | 89524A821B4FE966004A27BB /* Build configuration list for PBXProject "CFRuntime" */ = { 501 | isa = XCConfigurationList; 502 | buildConfigurations = ( 503 | 89524AA41B4FE967004A27BB /* Debug */, 504 | 89524AA51B4FE967004A27BB /* Release */, 505 | ); 506 | defaultConfigurationIsVisible = 0; 507 | defaultConfigurationName = Release; 508 | }; 509 | 89524AA61B4FE967004A27BB /* Build configuration list for PBXNativeTarget "CFRuntime" */ = { 510 | isa = XCConfigurationList; 511 | buildConfigurations = ( 512 | 89524AA71B4FE967004A27BB /* Debug */, 513 | 89524AA81B4FE967004A27BB /* Release */, 514 | ); 515 | defaultConfigurationIsVisible = 0; 516 | defaultConfigurationName = Release; 517 | }; 518 | 89524AA91B4FE967004A27BB /* Build configuration list for PBXNativeTarget "CFRuntimeTests" */ = { 519 | isa = XCConfigurationList; 520 | buildConfigurations = ( 521 | 89524AAA1B4FE967004A27BB /* Debug */, 522 | 89524AAB1B4FE967004A27BB /* Release */, 523 | ); 524 | defaultConfigurationIsVisible = 0; 525 | defaultConfigurationName = Release; 526 | }; 527 | /* End XCConfigurationList section */ 528 | }; 529 | rootObject = 89524A7F1B4FE966004A27BB /* Project object */; 530 | } 531 | -------------------------------------------------------------------------------- /CFRuntime.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /CFRuntime.xcodeproj/project.xcworkspace/xcshareddata/CFRuntime.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 53C629F8-A7FC-487F-A9A2-57E75411C58E 9 | IDESourceControlProjectName 10 | CFRuntime 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 9B15D23E4DF66B4CB2D8C4606947BA1B08A3FA31 14 | https://github.com/nsdictionary/CFRuntime.git 15 | 16 | IDESourceControlProjectPath 17 | CFRuntime.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 9B15D23E4DF66B4CB2D8C4606947BA1B08A3FA31 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/nsdictionary/CFRuntime.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 9B15D23E4DF66B4CB2D8C4606947BA1B08A3FA31 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 9B15D23E4DF66B4CB2D8C4606947BA1B08A3FA31 36 | IDESourceControlWCCName 37 | CFRuntime 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CFRuntime.xcodeproj/project.xcworkspace/xcuserdata/Charlin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CharlinFeng/CFRuntime/abde82ea49ab45ee92e3cfe0cca942df5d1e4a31/CFRuntime.xcodeproj/project.xcworkspace/xcuserdata/Charlin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CFRuntime.xcodeproj/xcuserdata/Charlin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /CFRuntime.xcodeproj/xcuserdata/Charlin.xcuserdatad/xcschemes/CFRuntime.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | 47 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 75 | 77 | 83 | 84 | 85 | 86 | 87 | 88 | 94 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /CFRuntime.xcodeproj/xcuserdata/Charlin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | CFRuntime.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 89524A861B4FE966004A27BB 16 | 17 | primary 18 | 19 | 20 | 89524A9B1B4FE967004A27BB 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /CFRuntime/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/10. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(application: UIApplication) { 33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /CFRuntime/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 20 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /CFRuntime/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 29 | 35 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/CFProperty/CFProperty+Extend.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CFProperty+Extend.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/11. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension CFProperty{ 12 | 13 | class func refrlectAction(mirror: Mirror) -> [CFProperty]?{ 14 | 15 | //获取所有属性名 16 | var propertyNames = mirror.names 17 | 18 | /** 获取所有的值 */ 19 | var propertyVaues = mirror.values 20 | 21 | /** 获取所有的类型 */ 22 | var types = mirror.types 23 | 24 | /** 获取所有类型名 */ 25 | var typeNames = mirror.typesShortName 26 | 27 | return CFProperty.makeProperties(propertyNames, values: propertyVaues, types:types ,typeNames:typeNames) 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/CFProperty/CFProperty.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CFProperty.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/10. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | 13 | 14 | class CFProperty { 15 | 16 | /** 属性名 */ 17 | var propertyName: String 18 | 19 | /** 属性值 */ 20 | var propertyValue: Any 21 | 22 | /** 属性类型 */ 23 | var propertyType: CFPropertyType 24 | 25 | 26 | 27 | /** 直接构造方法 */ 28 | init(propertyName: String,value: Any ,type: Any.Type , typeName: String){ 29 | 30 | self.propertyName = propertyName 31 | 32 | self.propertyValue = value 33 | 34 | self.propertyType = CFPropertyType(typeNameOriginal: typeName,type: type, selfType: value.self) 35 | } 36 | 37 | 38 | 39 | class func makeProperties (keys: [String],values: [Any], types:[Any.Type], typeNames: [String]) -> [CFProperty]? { 40 | 41 | var properties: [CFProperty] = [] 42 | 43 | for var i=0; i","\""]} 45 | 46 | private var typeNameOriginal: String{ 47 | 48 | set{ handleTypeName(newValue)} 49 | 50 | get{ return typeName } 51 | 52 | } 53 | 54 | 55 | /** 56 | 处理名字 57 | 58 | :param: name 类型名 59 | : 这个地方异常复杂,后期还需要做以下处理: 60 | : 1.正则处理swift数组 61 | : 2.反向引用获取swift数组泛型值类型,获取命名空间层次 62 | */ 63 | private func handleTypeName(name: String){ 64 | 65 | var nameNSStringM = NSMutableString(string: name) 66 | 67 | isOptional = nameNSStringM.rangeOfString(optionalString).length > 1 68 | 69 | //去除杂质 70 | specialStrings.enumerateArrayUsingClosure { (index: Int, value: String) -> Void in 71 | 72 | nameNSStringM.replaceOccurrencesOfString(value, withString: "", options: NSStringCompareOptions.CaseInsensitiveSearch, range: NSMakeRange(0, nameNSStringM.length)) 73 | } 74 | 75 | //分离命名空间 76 | typeName = nameNSStringM.componentsSeparatedByString(".").last as! String 77 | } 78 | 79 | 80 | 81 | /** 计算具体类型 */ 82 | private func calTypeEnum(){ 83 | 84 | self.typeEnum = CFPropertyTypeEnum.calTypeEnum(self.typeName) 85 | 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/CFPropertyType/CFPropertyTypeEnum.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CFPropertyTypeEnum.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/10. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | enum CFPropertyTypeEnum{ 12 | 13 | case unKnown 14 | 15 | case NSIntegerType 16 | 17 | case CGFloatType 18 | 19 | case NSStringType 20 | 21 | case StringType 22 | 23 | case IntType 24 | 25 | case BoolType 26 | 27 | case FloatType 28 | 29 | case DoubleType 30 | 31 | case CustomClassType 32 | 33 | 34 | static var typeDict: [String: CFPropertyTypeEnum] { 35 | 36 | return ["NSInteger":NSIntegerType, 37 | "CGFloat":CGFloatType, 38 | "NSString":NSStringType, 39 | "String": StringType, 40 | "Int":IntType, 41 | "Float":FloatType, 42 | "Double":DoubleType, 43 | "Bool": BoolType, 44 | ] 45 | 46 | } 47 | 48 | 49 | static func calTypeEnum(typeString: String) -> CFPropertyTypeEnum { 50 | 51 | return typeDict[typeString] ?? CFPropertyTypeEnum.CustomClassType 52 | 53 | 54 | } 55 | 56 | /** 是否是数值类型 */ 57 | static func isNumberType(typeEnum: CFPropertyTypeEnum) -> Bool{ 58 | 59 | return typeEnum == CFPropertyTypeEnum.CGFloatType || typeEnum == CFPropertyTypeEnum.FloatType || typeEnum == CFPropertyTypeEnum.DoubleType || typeEnum == CFPropertyTypeEnum.IntType 60 | } 61 | 62 | /** 是否是字符串类型 */ 63 | static func isStringType(typeEnum: CFPropertyTypeEnum) -> Bool{ 64 | return typeEnum == CFPropertyTypeEnum.NSStringType || typeEnum == CFPropertyTypeEnum.StringType 65 | } 66 | 67 | 68 | } -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/CFRunTime/Mirror+Extend.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Mirror+Extend.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/11. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension Mirror : CollectionType, SequenceType { 12 | 13 | init(_ Cls: NSObject.Type){ 14 | 15 | self.instance = Cls() 16 | mirror = reflect(instance) 17 | } 18 | 19 | init(_ instance: NSObject){ 20 | 21 | self.instance = instance 22 | mirror = reflect(instance) 23 | } 24 | 25 | public var names: [String] { 26 | return map(self) { $0.name } 27 | } 28 | 29 | 30 | public var values: [Any] { 31 | return map(self) { $0.value } 32 | } 33 | 34 | 35 | public var types: [Any.Type] { 36 | return map(self) { $0.type } 37 | } 38 | 39 | 40 | public var typesShortName: [String] { 41 | return map(self) { "\($0.type)"} 42 | } 43 | 44 | public var children: [MirrorItem] { 45 | return map(self) { $0 } 46 | } 47 | 48 | public subscript (key: String) -> Any? { 49 | let res = findFirst(self) { $0.name == key } 50 | return res.map { $0.value } 51 | } 52 | 53 | 54 | public func get(key: String) -> U? { 55 | let res = findFirst(self) { $0.name == key } 56 | return res.flatMap { $0.value as? U } 57 | } 58 | 59 | public var toDictionary: [String : Any] { 60 | 61 | var result: [String : Any] = [ : ] 62 | for item in self { 63 | result[item.name] = item.value 64 | } 65 | 66 | return result 67 | } 68 | 69 | public var toNSDictionary: NSDictionary { 70 | 71 | var result: [String : AnyObject] = [ : ] 72 | for item in self { 73 | result[item.name] = item.value as? AnyObject 74 | } 75 | 76 | return result 77 | } 78 | 79 | 80 | public func generate() -> IndexingGenerator<[MirrorItem]> { 81 | return children.generate() 82 | } 83 | 84 | public var startIndex: Int { 85 | return 0 86 | } 87 | 88 | public var endIndex: Int { 89 | return mirror.count 90 | } 91 | 92 | public subscript (i: Int) -> MirrorItem { 93 | return MirrorItem(mirror[i]) 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/CFRunTime/Mirror.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Mirror+Extend.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/11. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | 13 | /** 反射后镜像 */ 14 | public struct Mirror { 15 | 16 | let mirror: MirrorType 17 | let instance: NSObject 18 | } 19 | 20 | -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/CFRunTime/MirrorItem.swift: -------------------------------------------------------------------------------- 1 | // 2 | // MirrorItem.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/11. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | public struct MirrorItem { 12 | 13 | public let name: String 14 | 15 | public let type: Any.Type 16 | 17 | public let value: Any 18 | 19 | init(_ tup: (String, MirrorType)) { 20 | self.name = tup.0 21 | self.type = tup.1.valueType 22 | self.value = tup.1.value 23 | } 24 | } 25 | 26 | extension MirrorItem : Printable { 27 | public var description: String { 28 | return "\(name): \(type) = \(value)" 29 | } 30 | } -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/Common/CFRuntimeCommon.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CFRuntimeCommon.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/10. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | extension Array{ 13 | 14 | /** 仿OC遍历 */ 15 | func enumerateArrayUsingClosure(itemClosure: (index: Int , value: T)->Void){ 16 | 17 | for (var i=0;i (s: S, condition: (S.Generator.Element) -> Bool) -> S.Generator.Element? { 37 | 38 | for value in s { 39 | if condition(value) { 40 | return value 41 | } 42 | } 43 | return nil 44 | } -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/NSObject/NSNumber+CFRuntime.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSNumber+CFRuntime.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/11. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | func toDouble(str: String)-> NSNumber{ 12 | let numberFormatter = NSNumberFormatter() 13 | let number = numberFormatter.numberFromString(str)! 14 | return NSNumber(double: number.doubleValue) 15 | } 16 | 17 | func toFloat(str: String)-> NSNumber{ 18 | let numberFormatter = NSNumberFormatter() 19 | let number = numberFormatter.numberFromString(str)! 20 | return NSNumber(float: number.floatValue) 21 | } -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/NSObject/NSObject+KeyValues.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+KeyValues.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/10. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | 13 | 14 | extension NSObject { 15 | 16 | 17 | /** 一键字典转模型 */ 18 | class func objectWithKeyValues(dict: NSDictionary) -> Self{ 19 | 20 | var obj = self.alloc() 21 | 22 | self.enumerateProperties{(index: Int, property: CFProperty) -> Void in 23 | 24 | var key = property.propertyName 25 | 26 | if let val: AnyObject = dict[key] { 27 | 28 | /** 数值转NSValue */ 29 | var typeEnum = property.propertyType.typeEnum 30 | 31 | var valueObj = String(format: "\(val)") 32 | 33 | if( CFPropertyTypeEnum.isNumberType(typeEnum)){//Number 34 | 35 | var num = (valueObj as NSString).doubleValue 36 | 37 | // 38 | // if typeEnum == CFPropertyTypeEnum.NSIntegerType {valueObj = toFloat(val)} 39 | // if typeEnum == CFPropertyTypeEnum.IntType { valueObj = NSNumber(integer:val.toInt()!) } 40 | // 41 | // if typeEnum == CFPropertyTypeEnum.NSIntegerType {valueObj = val.toInt()!} 42 | // if typeEnum == CFPropertyTypeEnum.CGFloatType {valueObj = toFloat(val)} 43 | // if typeEnum == CFPropertyTypeEnum.FloatType {valueObj = toFloat(val)} 44 | // if typeEnum == CFPropertyTypeEnum.DoubleType {valueObj = toDouble(val)} 45 | // 46 | 47 | obj.setValue(num, forKeyPath: key) 48 | 49 | }else if(CFPropertyTypeEnum.isStringType(typeEnum)){//String 50 | 51 | if(property.propertyType.isOptional){ 52 | 53 | obj.setValue(valueObj, forKey: key) 54 | } 55 | 56 | }else if(CFPropertyTypeEnum.BoolType == typeEnum){//Bool 57 | 58 | obj.setValue(valueObj != "0", forKeyPath: key) 59 | 60 | }else if(CFPropertyTypeEnum.CustomClassType == typeEnum){//自定义对象 61 | 62 | //取出对应的dict 63 | var dictSub = (dict[key]! as AnyObject) as! NSDictionary 64 | 65 | 66 | //实例化对象 67 | var objType = property.propertyValue 68 | 69 | 70 | var Cls: NSObject.Type = property.propertyType.type as! NSObject.Type 71 | var subObj = Cls.objectWithKeyValues(dictSub) 72 | 73 | //设置值 74 | obj.setValue(subObj, forKeyPath: key) 75 | 76 | } 77 | } 78 | } 79 | 80 | return obj 81 | } 82 | 83 | 84 | 85 | 86 | /** 一键模型转字典 */ 87 | func keyValues() -> [String: Any]{ 88 | 89 | var dict = [String: Any]() 90 | 91 | //循环遍历 92 | for (index,property) in enumerate(self.properties!) { 93 | 94 | var key = property.propertyName 95 | var value = property.propertyValue 96 | 97 | if property.propertyType.isOptional {//属性可选 98 | 99 | var valueOptional = value as Any? 100 | 101 | if(valueOptional == nil){continue} 102 | } 103 | 104 | 105 | if(value is Bool){//Bool处理 106 | 107 | let boolValue = value as! Bool 108 | 109 | value = boolValue ? 1 : 0 110 | 111 | } 112 | 113 | if(property.propertyType.typeEnum == CFPropertyTypeEnum.CustomClassType){//自定义对象 114 | 115 | dict[key] = (property.propertyValue as! NSObject).keyValues() 116 | 117 | }else{//普通属性 118 | 119 | dict[key] = value 120 | } 121 | 122 | } 123 | 124 | return dict 125 | } 126 | 127 | } 128 | 129 | 130 | 131 | 132 | -------------------------------------------------------------------------------- /CFRuntime/CFRuntime/NSObject/NSObject+Mirror.swift: -------------------------------------------------------------------------------- 1 | // 2 | // NSObject+CFRuntime.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/10. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | 12 | 13 | /** 反射 */ 14 | extension NSObject { 15 | 16 | 17 | /** 类调用 */ 18 | 19 | /** 直接获取所有属性 */ 20 | class var properties: [CFProperty]? { 21 | 22 | //获取反射对象 23 | var mirror = Mirror(self) 24 | 25 | return CFProperty.refrlectAction(mirror) 26 | } 27 | 28 | 29 | 30 | 31 | /** 直接遍历所有成员对象 */ 32 | class func enumerateProperties(propertyClosure: (index: Int, property: CFProperty)->Void) -> Void{ 33 | 34 | self.properties?.enumerateArrayUsingClosure({ (i, value) -> Void in 35 | propertyClosure(index: i, property: value) 36 | }) 37 | 38 | } 39 | 40 | 41 | 42 | /** 方法调用 */ 43 | 44 | /** 反射所有成员属性对象 */ 45 | var properties: [CFProperty]?{ return CFProperty.refrlectAction(Mirror(self))} 46 | 47 | func enumerateProperties(propertyClosure: (index: Int, property: CFProperty)->Void) -> Void{ 48 | 49 | self.properties?.enumerateArrayUsingClosure({ (i, value) -> Void in 50 | propertyClosure(index: i, property: value) 51 | }) 52 | 53 | } 54 | 55 | 56 | 57 | } -------------------------------------------------------------------------------- /CFRuntime/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /CFRuntime/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "minimum-system-version" : "7.0", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "orientation" : "portrait", 11 | "idiom" : "iphone", 12 | "minimum-system-version" : "7.0", 13 | "subtype" : "retina4", 14 | "scale" : "2x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /CFRuntime/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | HM.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /CFRuntime/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // CFRuntime 4 | // 5 | // Created by 成林 on 15/7/10. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | 12 | enum StudentType: Int{ 13 | 14 | case Good = 0 15 | case Normal 16 | case Bad 17 | } 18 | 19 | 20 | struct Line { 21 | var start: Float 22 | var end: Float 23 | } 24 | 25 | class Pet { 26 | 27 | } 28 | 29 | 30 | 31 | class Person: NSObject { 32 | 33 | var name: NSString? 34 | var age: Int = 0 35 | var age2: NSInteger = 0 36 | 37 | var weight: Float = 0 38 | 39 | var weight2: CGFloat = 0 40 | 41 | var money: Double = 0 42 | 43 | var isLikeStudy: Bool = false 44 | 45 | var cat: Cat = Cat() 46 | } 47 | 48 | 49 | class Cat: NSObject { 50 | 51 | var name: String? 52 | 53 | var price: Double = 0 54 | 55 | } 56 | 57 | 58 | class ViewController: UIViewController { 59 | 60 | override func viewDidLoad() { 61 | super.viewDidLoad() 62 | 63 | 64 | var dict = [ 65 | 66 | "name":"张三", 67 | 68 | "age": "28", 69 | 70 | "age2":"28", 71 | 72 | "weight":"120", 73 | 74 | "weight2":"120", 75 | 76 | "money":"1800000", 77 | 78 | "isLikeStudy":"1", 79 | 80 | "stuType":"1", 81 | 82 | "cat": [ 83 | 84 | "name": "多多", 85 | 86 | "price": "4000" 87 | 88 | ] 89 | ] 90 | 91 | 92 | //kvc 93 | var person = Person.objectWithKeyValues(dict) 94 | 95 | var dict2 = person.keyValues() 96 | 97 | println(dict2) 98 | } 99 | 100 | 101 | } 102 | 103 | -------------------------------------------------------------------------------- /CFRuntime/show.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CharlinFeng/CFRuntime/abde82ea49ab45ee92e3cfe0cca942df5d1e4a31/CFRuntime/show.png -------------------------------------------------------------------------------- /CFRuntime/show2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CharlinFeng/CFRuntime/abde82ea49ab45ee92e3cfe0cca942df5d1e4a31/CFRuntime/show2.jpg -------------------------------------------------------------------------------- /CFRuntimeTests/CFRuntimeTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CFRuntimeTests.swift 3 | // CFRuntimeTests 4 | // 5 | // Created by 成林 on 15/7/10. 6 | // Copyright (c) 2015年 冯成林. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class CFRuntimeTests: XCTestCase { 13 | 14 | override func setUp() { 15 | super.setUp() 16 | // Put setup code here. This method is called before the invocation of each test method in the class. 17 | } 18 | 19 | override func tearDown() { 20 | // Put teardown code here. This method is called after the invocation of each test method in the class. 21 | super.tearDown() 22 | } 23 | 24 | func testExample() { 25 | // This is an example of a functional test case. 26 | XCTAssert(true, "Pass") 27 | } 28 | 29 | func testPerformanceExample() { 30 | // This is an example of a performance test case. 31 | self.measureBlock() { 32 | // Put the code you want to measure the time of here. 33 | } 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /CFRuntimeTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | HM.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### 已更新至 https://github.com/nsdictionary/Reflect 2 | 3 | #### 此页面即将删除 4 | --------------------------------------------------------------------------------