├── .gitignore ├── ReactSwift.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── ReactSwift ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── CounterApp.swift ├── Event.swift ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── ReactComponent.swift ├── ReactView.swift ├── ReactViewRenderer.swift ├── TimerApp.swift ├── ToDoApp.swift ├── UIButton+Events.swift └── ViewController.swift └── ReactSwiftTests ├── Info.plist └── ReactSwiftTests.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | node_modules 21 | -------------------------------------------------------------------------------- /ReactSwift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3C853E8F1A9E612C00E04C4D /* ToDoApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C853E8E1A9E612C00E04C4D /* ToDoApp.swift */; }; 11 | 3C853E911A9F5F4900E04C4D /* TimerApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C853E901A9F5F4900E04C4D /* TimerApp.swift */; }; 12 | 3CE7F8AC1A992B7900B9E79B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE7F8AB1A992B7900B9E79B /* AppDelegate.swift */; }; 13 | 3CE7F8AE1A992B7900B9E79B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE7F8AD1A992B7900B9E79B /* ViewController.swift */; }; 14 | 3CE7F8B11A992B7900B9E79B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3CE7F8AF1A992B7900B9E79B /* Main.storyboard */; }; 15 | 3CE7F8B31A992B7900B9E79B /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3CE7F8B21A992B7900B9E79B /* Images.xcassets */; }; 16 | 3CE7F8B61A992B7900B9E79B /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3CE7F8B41A992B7900B9E79B /* LaunchScreen.xib */; }; 17 | 3CE7F8C21A992B7900B9E79B /* ReactSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE7F8C11A992B7900B9E79B /* ReactSwiftTests.swift */; }; 18 | 3CE7F8CC1A992BA300B9E79B /* CounterApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE7F8CB1A992BA300B9E79B /* CounterApp.swift */; }; 19 | 3CE7F8CF1A992BCE00B9E79B /* ReactView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE7F8CE1A992BCE00B9E79B /* ReactView.swift */; }; 20 | 3CE7F8D11A992C5C00B9E79B /* ReactViewRenderer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE7F8D01A992C5C00B9E79B /* ReactViewRenderer.swift */; }; 21 | 3CE7F8D31A992C6A00B9E79B /* ReactComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE7F8D21A992C6A00B9E79B /* ReactComponent.swift */; }; 22 | 3CE7F8D51A9A4BD700B9E79B /* UIButton+Events.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE7F8D41A9A4BD700B9E79B /* UIButton+Events.swift */; }; 23 | 3CE7F8D71A9A4C1B00B9E79B /* Event.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3CE7F8D61A9A4C1B00B9E79B /* Event.swift */; }; 24 | 3CE7F8DA1A9A548D00B9E79B /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CE7F8D91A9A548D00B9E79B /* QuartzCore.framework */; }; 25 | /* End PBXBuildFile section */ 26 | 27 | /* Begin PBXContainerItemProxy section */ 28 | 3CE7F8BC1A992B7900B9E79B /* PBXContainerItemProxy */ = { 29 | isa = PBXContainerItemProxy; 30 | containerPortal = 3CE7F89E1A992B7900B9E79B /* Project object */; 31 | proxyType = 1; 32 | remoteGlobalIDString = 3CE7F8A51A992B7900B9E79B; 33 | remoteInfo = ReactSwift; 34 | }; 35 | /* End PBXContainerItemProxy section */ 36 | 37 | /* Begin PBXFileReference section */ 38 | 3C853E8E1A9E612C00E04C4D /* ToDoApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToDoApp.swift; sourceTree = ""; }; 39 | 3C853E901A9F5F4900E04C4D /* TimerApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TimerApp.swift; sourceTree = ""; }; 40 | 3CE7F8A61A992B7900B9E79B /* ReactSwift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReactSwift.app; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 3CE7F8AA1A992B7900B9E79B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 42 | 3CE7F8AB1A992B7900B9E79B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 43 | 3CE7F8AD1A992B7900B9E79B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 44 | 3CE7F8B01A992B7900B9E79B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 3CE7F8B21A992B7900B9E79B /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 46 | 3CE7F8B51A992B7900B9E79B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 47 | 3CE7F8BB1A992B7900B9E79B /* ReactSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ReactSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 48 | 3CE7F8C01A992B7900B9E79B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | 3CE7F8C11A992B7900B9E79B /* ReactSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReactSwiftTests.swift; sourceTree = ""; }; 50 | 3CE7F8CB1A992BA300B9E79B /* CounterApp.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CounterApp.swift; sourceTree = ""; }; 51 | 3CE7F8CE1A992BCE00B9E79B /* ReactView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReactView.swift; sourceTree = ""; }; 52 | 3CE7F8D01A992C5C00B9E79B /* ReactViewRenderer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReactViewRenderer.swift; sourceTree = ""; }; 53 | 3CE7F8D21A992C6A00B9E79B /* ReactComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReactComponent.swift; sourceTree = ""; }; 54 | 3CE7F8D41A9A4BD700B9E79B /* UIButton+Events.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIButton+Events.swift"; sourceTree = ""; }; 55 | 3CE7F8D61A9A4C1B00B9E79B /* Event.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Event.swift; sourceTree = ""; }; 56 | 3CE7F8D91A9A548D00B9E79B /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 3CE7F8A31A992B7900B9E79B /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | 3CE7F8DA1A9A548D00B9E79B /* QuartzCore.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | 3CE7F8B81A992B7900B9E79B /* Frameworks */ = { 69 | isa = PBXFrameworksBuildPhase; 70 | buildActionMask = 2147483647; 71 | files = ( 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | /* End PBXFrameworksBuildPhase section */ 76 | 77 | /* Begin PBXGroup section */ 78 | 3CE7F89D1A992B7900B9E79B = { 79 | isa = PBXGroup; 80 | children = ( 81 | 3CE7F8D91A9A548D00B9E79B /* QuartzCore.framework */, 82 | 3CE7F8A81A992B7900B9E79B /* ReactSwift */, 83 | 3CE7F8BE1A992B7900B9E79B /* ReactSwiftTests */, 84 | 3CE7F8A71A992B7900B9E79B /* Products */, 85 | ); 86 | sourceTree = ""; 87 | }; 88 | 3CE7F8A71A992B7900B9E79B /* Products */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 3CE7F8A61A992B7900B9E79B /* ReactSwift.app */, 92 | 3CE7F8BB1A992B7900B9E79B /* ReactSwiftTests.xctest */, 93 | ); 94 | name = Products; 95 | sourceTree = ""; 96 | }; 97 | 3CE7F8A81A992B7900B9E79B /* ReactSwift */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 3CE7F8CD1A992BB700B9E79B /* Framework */, 101 | 3CE7F8AB1A992B7900B9E79B /* AppDelegate.swift */, 102 | 3CE7F8AD1A992B7900B9E79B /* ViewController.swift */, 103 | 3CE7F8AF1A992B7900B9E79B /* Main.storyboard */, 104 | 3CE7F8B21A992B7900B9E79B /* Images.xcassets */, 105 | 3CE7F8B41A992B7900B9E79B /* LaunchScreen.xib */, 106 | 3CE7F8A91A992B7900B9E79B /* Supporting Files */, 107 | 3CE7F8CB1A992BA300B9E79B /* CounterApp.swift */, 108 | 3C853E8E1A9E612C00E04C4D /* ToDoApp.swift */, 109 | 3C853E901A9F5F4900E04C4D /* TimerApp.swift */, 110 | ); 111 | path = ReactSwift; 112 | sourceTree = ""; 113 | }; 114 | 3CE7F8A91A992B7900B9E79B /* Supporting Files */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | 3CE7F8AA1A992B7900B9E79B /* Info.plist */, 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | 3CE7F8BE1A992B7900B9E79B /* ReactSwiftTests */ = { 123 | isa = PBXGroup; 124 | children = ( 125 | 3CE7F8C11A992B7900B9E79B /* ReactSwiftTests.swift */, 126 | 3CE7F8BF1A992B7900B9E79B /* Supporting Files */, 127 | ); 128 | path = ReactSwiftTests; 129 | sourceTree = ""; 130 | }; 131 | 3CE7F8BF1A992B7900B9E79B /* Supporting Files */ = { 132 | isa = PBXGroup; 133 | children = ( 134 | 3CE7F8C01A992B7900B9E79B /* Info.plist */, 135 | ); 136 | name = "Supporting Files"; 137 | sourceTree = ""; 138 | }; 139 | 3CE7F8CD1A992BB700B9E79B /* Framework */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | 3CE7F8CE1A992BCE00B9E79B /* ReactView.swift */, 143 | 3CE7F8D01A992C5C00B9E79B /* ReactViewRenderer.swift */, 144 | 3CE7F8D21A992C6A00B9E79B /* ReactComponent.swift */, 145 | 3CE7F8D41A9A4BD700B9E79B /* UIButton+Events.swift */, 146 | 3CE7F8D61A9A4C1B00B9E79B /* Event.swift */, 147 | ); 148 | name = Framework; 149 | sourceTree = ""; 150 | }; 151 | /* End PBXGroup section */ 152 | 153 | /* Begin PBXNativeTarget section */ 154 | 3CE7F8A51A992B7900B9E79B /* ReactSwift */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = 3CE7F8C51A992B7900B9E79B /* Build configuration list for PBXNativeTarget "ReactSwift" */; 157 | buildPhases = ( 158 | 3CE7F8A21A992B7900B9E79B /* Sources */, 159 | 3CE7F8A31A992B7900B9E79B /* Frameworks */, 160 | 3CE7F8A41A992B7900B9E79B /* Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | ); 166 | name = ReactSwift; 167 | productName = ReactSwift; 168 | productReference = 3CE7F8A61A992B7900B9E79B /* ReactSwift.app */; 169 | productType = "com.apple.product-type.application"; 170 | }; 171 | 3CE7F8BA1A992B7900B9E79B /* ReactSwiftTests */ = { 172 | isa = PBXNativeTarget; 173 | buildConfigurationList = 3CE7F8C81A992B7900B9E79B /* Build configuration list for PBXNativeTarget "ReactSwiftTests" */; 174 | buildPhases = ( 175 | 3CE7F8B71A992B7900B9E79B /* Sources */, 176 | 3CE7F8B81A992B7900B9E79B /* Frameworks */, 177 | 3CE7F8B91A992B7900B9E79B /* Resources */, 178 | ); 179 | buildRules = ( 180 | ); 181 | dependencies = ( 182 | 3CE7F8BD1A992B7900B9E79B /* PBXTargetDependency */, 183 | ); 184 | name = ReactSwiftTests; 185 | productName = ReactSwiftTests; 186 | productReference = 3CE7F8BB1A992B7900B9E79B /* ReactSwiftTests.xctest */; 187 | productType = "com.apple.product-type.bundle.unit-test"; 188 | }; 189 | /* End PBXNativeTarget section */ 190 | 191 | /* Begin PBXProject section */ 192 | 3CE7F89E1A992B7900B9E79B /* Project object */ = { 193 | isa = PBXProject; 194 | attributes = { 195 | LastUpgradeCheck = 0610; 196 | ORGANIZATIONNAME = "Colin Eberhardt"; 197 | TargetAttributes = { 198 | 3CE7F8A51A992B7900B9E79B = { 199 | CreatedOnToolsVersion = 6.1; 200 | }; 201 | 3CE7F8BA1A992B7900B9E79B = { 202 | CreatedOnToolsVersion = 6.1; 203 | TestTargetID = 3CE7F8A51A992B7900B9E79B; 204 | }; 205 | }; 206 | }; 207 | buildConfigurationList = 3CE7F8A11A992B7900B9E79B /* Build configuration list for PBXProject "ReactSwift" */; 208 | compatibilityVersion = "Xcode 3.2"; 209 | developmentRegion = English; 210 | hasScannedForEncodings = 0; 211 | knownRegions = ( 212 | en, 213 | Base, 214 | ); 215 | mainGroup = 3CE7F89D1A992B7900B9E79B; 216 | productRefGroup = 3CE7F8A71A992B7900B9E79B /* Products */; 217 | projectDirPath = ""; 218 | projectRoot = ""; 219 | targets = ( 220 | 3CE7F8A51A992B7900B9E79B /* ReactSwift */, 221 | 3CE7F8BA1A992B7900B9E79B /* ReactSwiftTests */, 222 | ); 223 | }; 224 | /* End PBXProject section */ 225 | 226 | /* Begin PBXResourcesBuildPhase section */ 227 | 3CE7F8A41A992B7900B9E79B /* Resources */ = { 228 | isa = PBXResourcesBuildPhase; 229 | buildActionMask = 2147483647; 230 | files = ( 231 | 3CE7F8B11A992B7900B9E79B /* Main.storyboard in Resources */, 232 | 3CE7F8B61A992B7900B9E79B /* LaunchScreen.xib in Resources */, 233 | 3CE7F8B31A992B7900B9E79B /* Images.xcassets in Resources */, 234 | ); 235 | runOnlyForDeploymentPostprocessing = 0; 236 | }; 237 | 3CE7F8B91A992B7900B9E79B /* Resources */ = { 238 | isa = PBXResourcesBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | ); 242 | runOnlyForDeploymentPostprocessing = 0; 243 | }; 244 | /* End PBXResourcesBuildPhase section */ 245 | 246 | /* Begin PBXSourcesBuildPhase section */ 247 | 3CE7F8A21A992B7900B9E79B /* Sources */ = { 248 | isa = PBXSourcesBuildPhase; 249 | buildActionMask = 2147483647; 250 | files = ( 251 | 3CE7F8D71A9A4C1B00B9E79B /* Event.swift in Sources */, 252 | 3CE7F8CF1A992BCE00B9E79B /* ReactView.swift in Sources */, 253 | 3CE7F8D31A992C6A00B9E79B /* ReactComponent.swift in Sources */, 254 | 3C853E8F1A9E612C00E04C4D /* ToDoApp.swift in Sources */, 255 | 3CE7F8CC1A992BA300B9E79B /* CounterApp.swift in Sources */, 256 | 3CE7F8AE1A992B7900B9E79B /* ViewController.swift in Sources */, 257 | 3CE7F8D51A9A4BD700B9E79B /* UIButton+Events.swift in Sources */, 258 | 3C853E911A9F5F4900E04C4D /* TimerApp.swift in Sources */, 259 | 3CE7F8D11A992C5C00B9E79B /* ReactViewRenderer.swift in Sources */, 260 | 3CE7F8AC1A992B7900B9E79B /* AppDelegate.swift in Sources */, 261 | ); 262 | runOnlyForDeploymentPostprocessing = 0; 263 | }; 264 | 3CE7F8B71A992B7900B9E79B /* Sources */ = { 265 | isa = PBXSourcesBuildPhase; 266 | buildActionMask = 2147483647; 267 | files = ( 268 | 3CE7F8C21A992B7900B9E79B /* ReactSwiftTests.swift in Sources */, 269 | ); 270 | runOnlyForDeploymentPostprocessing = 0; 271 | }; 272 | /* End PBXSourcesBuildPhase section */ 273 | 274 | /* Begin PBXTargetDependency section */ 275 | 3CE7F8BD1A992B7900B9E79B /* PBXTargetDependency */ = { 276 | isa = PBXTargetDependency; 277 | target = 3CE7F8A51A992B7900B9E79B /* ReactSwift */; 278 | targetProxy = 3CE7F8BC1A992B7900B9E79B /* PBXContainerItemProxy */; 279 | }; 280 | /* End PBXTargetDependency section */ 281 | 282 | /* Begin PBXVariantGroup section */ 283 | 3CE7F8AF1A992B7900B9E79B /* Main.storyboard */ = { 284 | isa = PBXVariantGroup; 285 | children = ( 286 | 3CE7F8B01A992B7900B9E79B /* Base */, 287 | ); 288 | name = Main.storyboard; 289 | sourceTree = ""; 290 | }; 291 | 3CE7F8B41A992B7900B9E79B /* LaunchScreen.xib */ = { 292 | isa = PBXVariantGroup; 293 | children = ( 294 | 3CE7F8B51A992B7900B9E79B /* Base */, 295 | ); 296 | name = LaunchScreen.xib; 297 | sourceTree = ""; 298 | }; 299 | /* End PBXVariantGroup section */ 300 | 301 | /* Begin XCBuildConfiguration section */ 302 | 3CE7F8C31A992B7900B9E79B /* Debug */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 307 | CLANG_CXX_LIBRARY = "libc++"; 308 | CLANG_ENABLE_MODULES = YES; 309 | CLANG_ENABLE_OBJC_ARC = YES; 310 | CLANG_WARN_BOOL_CONVERSION = YES; 311 | CLANG_WARN_CONSTANT_CONVERSION = YES; 312 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 313 | CLANG_WARN_EMPTY_BODY = YES; 314 | CLANG_WARN_ENUM_CONVERSION = YES; 315 | CLANG_WARN_INT_CONVERSION = YES; 316 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 317 | CLANG_WARN_UNREACHABLE_CODE = YES; 318 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 319 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 320 | COPY_PHASE_STRIP = NO; 321 | ENABLE_STRICT_OBJC_MSGSEND = YES; 322 | GCC_C_LANGUAGE_STANDARD = gnu99; 323 | GCC_DYNAMIC_NO_PIC = NO; 324 | GCC_OPTIMIZATION_LEVEL = 0; 325 | GCC_PREPROCESSOR_DEFINITIONS = ( 326 | "DEBUG=1", 327 | "$(inherited)", 328 | ); 329 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 330 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 331 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 332 | GCC_WARN_UNDECLARED_SELECTOR = YES; 333 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 334 | GCC_WARN_UNUSED_FUNCTION = YES; 335 | GCC_WARN_UNUSED_VARIABLE = YES; 336 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 337 | MTL_ENABLE_DEBUG_INFO = YES; 338 | ONLY_ACTIVE_ARCH = YES; 339 | SDKROOT = iphoneos; 340 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 341 | }; 342 | name = Debug; 343 | }; 344 | 3CE7F8C41A992B7900B9E79B /* Release */ = { 345 | isa = XCBuildConfiguration; 346 | buildSettings = { 347 | ALWAYS_SEARCH_USER_PATHS = NO; 348 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 349 | CLANG_CXX_LIBRARY = "libc++"; 350 | CLANG_ENABLE_MODULES = YES; 351 | CLANG_ENABLE_OBJC_ARC = YES; 352 | CLANG_WARN_BOOL_CONVERSION = YES; 353 | CLANG_WARN_CONSTANT_CONVERSION = YES; 354 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 355 | CLANG_WARN_EMPTY_BODY = YES; 356 | CLANG_WARN_ENUM_CONVERSION = YES; 357 | CLANG_WARN_INT_CONVERSION = YES; 358 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = YES; 363 | ENABLE_NS_ASSERTIONS = NO; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | GCC_C_LANGUAGE_STANDARD = gnu99; 366 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 367 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 368 | GCC_WARN_UNDECLARED_SELECTOR = YES; 369 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 370 | GCC_WARN_UNUSED_FUNCTION = YES; 371 | GCC_WARN_UNUSED_VARIABLE = YES; 372 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 373 | MTL_ENABLE_DEBUG_INFO = NO; 374 | SDKROOT = iphoneos; 375 | VALIDATE_PRODUCT = YES; 376 | }; 377 | name = Release; 378 | }; 379 | 3CE7F8C61A992B7900B9E79B /* Debug */ = { 380 | isa = XCBuildConfiguration; 381 | buildSettings = { 382 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 383 | INFOPLIST_FILE = ReactSwift/Info.plist; 384 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 385 | PRODUCT_NAME = "$(TARGET_NAME)"; 386 | }; 387 | name = Debug; 388 | }; 389 | 3CE7F8C71A992B7900B9E79B /* Release */ = { 390 | isa = XCBuildConfiguration; 391 | buildSettings = { 392 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 393 | INFOPLIST_FILE = ReactSwift/Info.plist; 394 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 395 | PRODUCT_NAME = "$(TARGET_NAME)"; 396 | }; 397 | name = Release; 398 | }; 399 | 3CE7F8C91A992B7900B9E79B /* Debug */ = { 400 | isa = XCBuildConfiguration; 401 | buildSettings = { 402 | BUNDLE_LOADER = "$(TEST_HOST)"; 403 | FRAMEWORK_SEARCH_PATHS = ( 404 | "$(SDKROOT)/Developer/Library/Frameworks", 405 | "$(inherited)", 406 | ); 407 | GCC_PREPROCESSOR_DEFINITIONS = ( 408 | "DEBUG=1", 409 | "$(inherited)", 410 | ); 411 | INFOPLIST_FILE = ReactSwiftTests/Info.plist; 412 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 413 | PRODUCT_NAME = "$(TARGET_NAME)"; 414 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactSwift.app/ReactSwift"; 415 | }; 416 | name = Debug; 417 | }; 418 | 3CE7F8CA1A992B7900B9E79B /* Release */ = { 419 | isa = XCBuildConfiguration; 420 | buildSettings = { 421 | BUNDLE_LOADER = "$(TEST_HOST)"; 422 | FRAMEWORK_SEARCH_PATHS = ( 423 | "$(SDKROOT)/Developer/Library/Frameworks", 424 | "$(inherited)", 425 | ); 426 | INFOPLIST_FILE = ReactSwiftTests/Info.plist; 427 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 428 | PRODUCT_NAME = "$(TARGET_NAME)"; 429 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ReactSwift.app/ReactSwift"; 430 | }; 431 | name = Release; 432 | }; 433 | /* End XCBuildConfiguration section */ 434 | 435 | /* Begin XCConfigurationList section */ 436 | 3CE7F8A11A992B7900B9E79B /* Build configuration list for PBXProject "ReactSwift" */ = { 437 | isa = XCConfigurationList; 438 | buildConfigurations = ( 439 | 3CE7F8C31A992B7900B9E79B /* Debug */, 440 | 3CE7F8C41A992B7900B9E79B /* Release */, 441 | ); 442 | defaultConfigurationIsVisible = 0; 443 | defaultConfigurationName = Release; 444 | }; 445 | 3CE7F8C51A992B7900B9E79B /* Build configuration list for PBXNativeTarget "ReactSwift" */ = { 446 | isa = XCConfigurationList; 447 | buildConfigurations = ( 448 | 3CE7F8C61A992B7900B9E79B /* Debug */, 449 | 3CE7F8C71A992B7900B9E79B /* Release */, 450 | ); 451 | defaultConfigurationIsVisible = 0; 452 | defaultConfigurationName = Release; 453 | }; 454 | 3CE7F8C81A992B7900B9E79B /* Build configuration list for PBXNativeTarget "ReactSwiftTests" */ = { 455 | isa = XCConfigurationList; 456 | buildConfigurations = ( 457 | 3CE7F8C91A992B7900B9E79B /* Debug */, 458 | 3CE7F8CA1A992B7900B9E79B /* Release */, 459 | ); 460 | defaultConfigurationIsVisible = 0; 461 | defaultConfigurationName = Release; 462 | }; 463 | /* End XCConfigurationList section */ 464 | }; 465 | rootObject = 3CE7F89E1A992B7900B9E79B /* Project object */; 466 | } 467 | -------------------------------------------------------------------------------- /ReactSwift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ReactSwift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // ReactSwift 4 | // 5 | // Created by Colin Eberhardt on 21/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. 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 | -------------------------------------------------------------------------------- /ReactSwift/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 | -------------------------------------------------------------------------------- /ReactSwift/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 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ReactSwift/CounterApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToDoApp.swift 3 | // ReactSwift 4 | // 5 | // Created by Colin Eberhardt on 21/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | let outerFrame = CGRect(x: 100, y: 100, width: 100, height: 70) 12 | let countFrame = CGRect(x: 50, y: 0, width: 100, height: 50) 13 | let spinControlFrame = CGRect(x: 0, y: 50, width: 100, height: 20) 14 | let upButtonFrame = CGRect(x: 50, y: 0, width: 50, height: 20) 15 | let downButtonFrame = CGRect(x: 0, y: 0, width: 50, height: 20) 16 | 17 | class CounterApp: ReactComponent { 18 | 19 | var count: Int = 0 20 | 21 | func changeNumber(newValue: Int) { 22 | count = newValue 23 | 24 | _youCannotSeeMe.render() 25 | } 26 | 27 | func render() -> ReactView { 28 | return ReactView.View(outerFrame, 29 | [ 30 | ReactView.Text(countFrame, "\(count)"), 31 | Toolbar(frame: spinControlFrame, count: count, updateFunc: changeNumber) 32 | ]) 33 | } 34 | } 35 | 36 | struct Toolbar: ReactComponent { 37 | 38 | let frame: CGRect 39 | let count: Int 40 | let updateFunc: Int -> () 41 | 42 | func up() { 43 | updateFunc(count + 1) 44 | } 45 | 46 | func down() { 47 | updateFunc(count - 1) 48 | } 49 | 50 | func render() -> ReactView { 51 | let upHandler = EventHandlerWrapper(target: self, handler: Toolbar.up) 52 | let downHandler = EventHandlerWrapper(target: self, handler: Toolbar.down) 53 | 54 | return ReactView.View(frame, 55 | [ReactView.Button(upButtonFrame, "up", upHandler), 56 | ReactView.Button(downButtonFrame, "down", downHandler), 57 | ]) 58 | } 59 | } -------------------------------------------------------------------------------- /ReactSwift/Event.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Event.swift 3 | // SwiftPlaces 4 | // 5 | // Created by Colin Eberhardt on 27/11/2014. 6 | // Copyright (c) 2014 iJoshSmith. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | class Event { 12 | 13 | typealias EventHandler = T -> () 14 | 15 | private var eventHandlers = [Invocable]() 16 | 17 | init() { 18 | } 19 | 20 | /// Raises the event, invoking all handlers 21 | func raise(data: T) { 22 | for handler in self.eventHandlers { 23 | handler.invoke(data) 24 | } 25 | } 26 | 27 | 28 | func addHandler(invocable: Invocable) { 29 | eventHandlers.append(invocable) 30 | } 31 | } 32 | 33 | public protocol Invocable: class { 34 | func invoke(data: Any) 35 | } 36 | 37 | // takes a reference to a handler, as a class method, allowing 38 | // a weak reference to the owning type. 39 | // see: http://oleb.net/blog/2014/07/swift-instance-methods-curried-functions/ 40 | public class EventHandlerWrapper : Invocable { 41 | var target: T? 42 | let handler: T -> U -> () 43 | 44 | init(target: T?, handler: T -> U -> ()){ 45 | self.target = target 46 | self.handler = handler 47 | } 48 | 49 | public func invoke(data: Any) -> () { 50 | if let t = target { 51 | handler(t)(data as U) 52 | } 53 | } 54 | 55 | } 56 | 57 | 58 | -------------------------------------------------------------------------------- /ReactSwift/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 | } -------------------------------------------------------------------------------- /ReactSwift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.scottlogic.$(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 | -------------------------------------------------------------------------------- /ReactSwift/ReactComponent.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ReactComponent.swift 3 | // ReactSwift 4 | // 5 | // Created by Colin Eberhardt on 21/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | protocol ReactComponent { 12 | func render() -> ReactView 13 | } -------------------------------------------------------------------------------- /ReactSwift/ReactView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ReactView.swift 3 | // ReactSwift 4 | // 5 | // Created by Colin Eberhardt on 21/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | enum ReactView: ReactComponent { 12 | case View(CGRect, [ReactComponent]) 13 | case Button(CGRect, String, Invocable) 14 | case Text(CGRect, String) 15 | case TextField(CGRect, String, Invocable) 16 | 17 | func render() -> ReactView { 18 | return self 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ReactSwift/ReactViewRenderer.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ReactViewRenderer.swift 3 | // ReactSwift 4 | // 5 | // Created by Colin Eberhardt on 21/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ReactViewRenderer { 12 | let hostView: UIView 13 | let component: ReactComponent 14 | 15 | // we need to retain the most recent view, so that any event handlers 16 | // are retained 17 | var reactView: ReactView! 18 | 19 | init(hostView: UIView, component: ReactComponent) { 20 | self.hostView = hostView 21 | self.component = component 22 | render() 23 | } 24 | 25 | func render() { 26 | reactView = self.component.render() 27 | let uiView = createView(reactView); 28 | 29 | for subview in hostView.subviews { 30 | subview.removeFromSuperview() 31 | } 32 | self.hostView.addSubview(uiView) 33 | } 34 | } 35 | 36 | // a monsterous hack! 37 | var reactComponents = [ReactComponent]() 38 | 39 | func createView(virtualView: ReactView) -> UIView { 40 | switch virtualView { 41 | case let .View(frame, children): 42 | let view = UIView(frame: frame) 43 | view.backgroundColor = UIColor(white: 0.0, alpha: 0.1) 44 | for child in children { 45 | reactComponents.append(child) 46 | view.addSubview(createView(child.render())) 47 | } 48 | return view 49 | 50 | case let .Button(frame, text, invocable): 51 | let view = UIButton(frame: frame) 52 | view.setTitleColor(UIColor.blueColor(), forState: .Normal) 53 | view.setTitle(text, forState: .Normal) 54 | view.tappedEvent.addHandler(invocable) 55 | return view 56 | 57 | case let .Text(frame, text): 58 | let view = UILabel(frame: frame) 59 | view.text = text 60 | return view 61 | 62 | case let .TextField(frame, text, invocable): 63 | let view = UITextField(frame: frame) 64 | view.text = text 65 | view.changedEvent.addHandler(invocable) 66 | return view 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /ReactSwift/TimerApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // TimerApp.swift 3 | // ReactSwift 4 | // 5 | // Created by Colin Eberhardt on 26/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | let timerFrame = CGRect(x: 100, y: 100, width: 200, height: 35) 12 | let textFrame = CGRect(x: 60, y: 10, width: 100, height: 20) 13 | 14 | class TimerApp: NSObject, ReactComponent { 15 | 16 | var time = NSDate() 17 | 18 | override init() { 19 | super.init() 20 | NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: "tick", userInfo: nil, repeats: true) 21 | } 22 | 23 | func tick() { 24 | time = NSDate() 25 | _youCannotSeeMe.render() 26 | } 27 | 28 | func render() -> ReactView { 29 | 30 | let formatter = NSDateFormatter() 31 | formatter.dateFormat = "hh:mm:ss" 32 | 33 | return ReactView.View(timerFrame, 34 | [ 35 | ReactView.Text(textFrame, "\(formatter.stringFromDate(time))") 36 | ]) 37 | } 38 | } -------------------------------------------------------------------------------- /ReactSwift/ToDoApp.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ToDoApp.swift 3 | // ReactSwift 4 | // 5 | // Created by Colin Eberhardt on 25/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ToDoApp: ReactComponent { 12 | 13 | var items = ["feed the cat", "adopt swift"] 14 | var newItem = "" 15 | 16 | func textChanged(value: String) { 17 | newItem = value 18 | } 19 | 20 | func itemDeleted(index: Int) { 21 | items.removeAtIndex(index) 22 | _youCannotSeeMe.render() 23 | } 24 | 25 | func addItem() { 26 | items.append(newItem) 27 | _youCannotSeeMe.render() 28 | } 29 | 30 | func render() -> ReactView { 31 | 32 | let textChangedHandler = EventHandlerWrapper(target: self, handler: ToDoApp.textChanged) 33 | let addItemHandler = EventHandlerWrapper(target: self, handler: ToDoApp.addItem) 34 | 35 | return ReactView.View(CGRect(x: 0, y: 0, width: 300, height: 500), 36 | [ 37 | ReactView.TextField(CGRect(x: 0, y: 0, width: 200, height: 50), "", textChangedHandler), 38 | ReactView.Button(CGRect(x: 200, y: 0, width: 100, height: 50), "Add", addItemHandler), 39 | ListItems(frame: CGRect(x: 0, y: 100, width: 300, height: 500), items: items, deleteAction: itemDeleted) 40 | ]) 41 | } 42 | } 43 | 44 | class ListItem: ReactComponent { 45 | let item: String 46 | let frame: CGRect 47 | let deleteAction: () -> () 48 | 49 | init(frame: CGRect, item: String, deleteAction: () -> ()) { 50 | self.frame = frame 51 | self.item = item 52 | self.deleteAction = deleteAction 53 | } 54 | 55 | func deleteItem() { 56 | deleteAction() 57 | } 58 | 59 | func render() -> ReactView { 60 | 61 | let addItemHandler = EventHandlerWrapper(target: self, handler: ListItem.deleteItem) 62 | 63 | return ReactView.View(frame, 64 | [ 65 | ReactView.Text(CGRect(x: 0, y: 0, width: 100, height: 50), item), 66 | ReactView.Button(CGRect(x: 50, y: 0, width: 100, height: 50), "x", addItemHandler) 67 | ]) 68 | } 69 | } 70 | 71 | class ListItems: ReactComponent { 72 | 73 | let items: [String] 74 | let frame: CGRect 75 | let deleteAction: (Int) -> () 76 | 77 | init(frame: CGRect, items: [String], deleteAction: (Int) -> ()) { 78 | self.frame = frame 79 | self.items = items 80 | self.deleteAction = deleteAction 81 | } 82 | 83 | func voi() { 84 | println("deleted") 85 | } 86 | 87 | func render() -> ReactView { 88 | var children = [ReactComponent]() 89 | var offset: CGFloat = 0.0 90 | for item in enumerate(items) { 91 | children.append(ListItem(frame: CGRect(x: 0, y: offset, width: frame.width, height: 50), item: item.element) { 92 | self.deleteAction(item.index) 93 | }) 94 | offset += 50 95 | } 96 | 97 | return ReactView.View(frame, children) 98 | } 99 | } -------------------------------------------------------------------------------- /ReactSwift/UIButton+Events.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIButton+Events.swift 3 | // ReactSwift 4 | // 5 | // Created by Colin Eberhardt on 22/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | var key: UInt8 = 0 12 | 13 | extension UIButton { 14 | 15 | /// An action that is invoked when the button is tapped 16 | var tappedEvent: Event { 17 | get { 18 | let maybeEvent = objc_getAssociatedObject(self, &key) as Event? 19 | if let event = maybeEvent { 20 | return event 21 | } else { 22 | let event = Event() 23 | addTarget(self, action: "tapped", forControlEvents: .TouchUpInside) 24 | objc_setAssociatedObject(self, &key, event, UInt(OBJC_ASSOCIATION_RETAIN)) 25 | return event 26 | } 27 | } 28 | } 29 | 30 | func tapped() { 31 | tappedEvent.raise() 32 | } 33 | 34 | } 35 | 36 | extension UITextField { 37 | 38 | /// An action that is invoked when the button is tapped 39 | var changedEvent: Event { 40 | get { 41 | let maybeEvent = objc_getAssociatedObject(self, &key) as Event? 42 | if let event = maybeEvent { 43 | return event 44 | } else { 45 | let event = Event() 46 | addTarget(self, action: "changed", forControlEvents: .EditingChanged) 47 | objc_setAssociatedObject(self, &key, event, UInt(OBJC_ASSOCIATION_RETAIN)) 48 | return event 49 | } 50 | } 51 | } 52 | 53 | func changed() { 54 | changedEvent.raise(self.text) 55 | } 56 | 57 | } 58 | 59 | 60 | -------------------------------------------------------------------------------- /ReactSwift/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // ReactSwift 4 | // 5 | // Created by Colin Eberhardt on 21/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | var _youCannotSeeMe: ReactViewRenderer! 12 | 13 | class ViewController: UIViewController { 14 | 15 | let app = TimerApp(); 16 | 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | 20 | _youCannotSeeMe = ReactViewRenderer(hostView: view, component: app) 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /ReactSwiftTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.scottlogic.$(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 | -------------------------------------------------------------------------------- /ReactSwiftTests/ReactSwiftTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ReactSwiftTests.swift 3 | // ReactSwiftTests 4 | // 5 | // Created by Colin Eberhardt on 21/02/2015. 6 | // Copyright (c) 2015 Colin Eberhardt. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class ReactSwiftTests: 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 | --------------------------------------------------------------------------------