├── .gitignore ├── .gitmodules ├── Cartfile ├── Cartfile.resolved ├── README.md ├── ReactKit-APIKit-Himotoki-sample.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata └── ReactKit-APIKit-Himotoki-sample ├── AppDelegate.swift ├── Assets.xcassets └── AppIcon.appiconset │ └── Contents.json ├── Base.lproj ├── LaunchScreen.storyboard └── Main.storyboard ├── IncrementalSearchViewController.swift ├── Info.plist ├── QiitaAPI.swift └── Session+SwiftTask.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 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | # Pods/ 27 | 28 | # Carthage 29 | # 30 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 31 | # Carthage/Checkouts 32 | 33 | Carthage/Build 34 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Carthage/Checkouts/Himotoki"] 2 | path = Carthage/Checkouts/Himotoki 3 | url = https://github.com/ikesyo/Himotoki.git 4 | [submodule "Carthage/Checkouts/Result"] 5 | path = Carthage/Checkouts/Result 6 | url = https://github.com/antitypical/Result.git 7 | [submodule "Carthage/Checkouts/SwiftTask"] 8 | path = Carthage/Checkouts/SwiftTask 9 | url = https://github.com/ReactKit/SwiftTask.git 10 | [submodule "Carthage/Checkouts/APIKit"] 11 | path = Carthage/Checkouts/APIKit 12 | url = https://github.com/ishkawa/APIKit.git 13 | [submodule "Carthage/Checkouts/ReactKit"] 14 | path = Carthage/Checkouts/ReactKit 15 | url = https://github.com/ReactKit/ReactKit.git 16 | -------------------------------------------------------------------------------- /Cartfile: -------------------------------------------------------------------------------- 1 | github "ishkawa/APIKit" "1.0.0-beta.9" 2 | github "ikesyo/Himotoki" ~> 1.0 3 | github "ReactKit/ReactKit" 4 | 5 | -------------------------------------------------------------------------------- /Cartfile.resolved: -------------------------------------------------------------------------------- 1 | github "ikesyo/Himotoki" "1.1.2" 2 | github "antitypical/Result" "0.6.0-beta.3" 3 | github "ReactKit/SwiftTask" "4.0.0" 4 | github "ishkawa/APIKit" "1.0.0-beta.9" 5 | github "ReactKit/ReactKit" "0.12.0" 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ReactKit-APIKit-Himotoki-sample 2 | Incremental search sample created using: 3 | 4 | - Swift 2.1 5 | - ReactKit 0.12.0 6 | - https://github.com/ReactKit/ReactKit/releases/tag/0.12.0 7 | - APIKit 1.0.0-beta.9 8 | - https://github.com/ishkawa/APIKit/releases/tag/1.0.0-beta.9 9 | - Himotoki 1.1.2 10 | - https://github.com/ikesyo/Himotoki/releases/tag/1.1.2 11 | - Qiita API v2 12 | - https://qiita.com/api/v2/docs 13 | - **IMPORTANT:** For unauthenticated requests, you can make up to 60 requests per hour 14 | -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | CBB232FF1BC3B9560079375D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBB232FE1BC3B9560079375D /* AppDelegate.swift */; }; 11 | CBB233041BC3B9560079375D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CBB233021BC3B9560079375D /* Main.storyboard */; }; 12 | CBB233061BC3B9560079375D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = CBB233051BC3B9560079375D /* Assets.xcassets */; }; 13 | CBB233091BC3B9560079375D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CBB233071BC3B9560079375D /* LaunchScreen.storyboard */; }; 14 | CBB233111BC3C09E0079375D /* Cartfile in Resources */ = {isa = PBXBuildFile; fileRef = CBB233101BC3C09E0079375D /* Cartfile */; }; 15 | CBB233141BC3C0F80079375D /* IncrementalSearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBB233131BC3C0F80079375D /* IncrementalSearchViewController.swift */; }; 16 | CBB2331A1BC3C1B70079375D /* APIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233151BC3C1B70079375D /* APIKit.framework */; }; 17 | CBB2331B1BC3C1B70079375D /* APIKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233151BC3C1B70079375D /* APIKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 18 | CBB2331C1BC3C1B70079375D /* Himotoki.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233161BC3C1B70079375D /* Himotoki.framework */; }; 19 | CBB2331D1BC3C1B70079375D /* Himotoki.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233161BC3C1B70079375D /* Himotoki.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 20 | CBB2331E1BC3C1B70079375D /* ReactKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233171BC3C1B70079375D /* ReactKit.framework */; }; 21 | CBB2331F1BC3C1B70079375D /* ReactKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233171BC3C1B70079375D /* ReactKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 22 | CBB233201BC3C1B70079375D /* Result.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233181BC3C1B70079375D /* Result.framework */; }; 23 | CBB233211BC3C1B70079375D /* Result.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233181BC3C1B70079375D /* Result.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 24 | CBB233221BC3C1B70079375D /* SwiftTask.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233191BC3C1B70079375D /* SwiftTask.framework */; }; 25 | CBB233231BC3C1B70079375D /* SwiftTask.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = CBB233191BC3C1B70079375D /* SwiftTask.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 26 | CBB233261BC3C1E20079375D /* QiitaAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBB233251BC3C1E20079375D /* QiitaAPI.swift */; }; 27 | CBB233281BC3C1FE0079375D /* Session+SwiftTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = CBB233271BC3C1FE0079375D /* Session+SwiftTask.swift */; }; 28 | /* End PBXBuildFile section */ 29 | 30 | /* Begin PBXCopyFilesBuildPhase section */ 31 | CBB233241BC3C1B80079375D /* Embed Frameworks */ = { 32 | isa = PBXCopyFilesBuildPhase; 33 | buildActionMask = 2147483647; 34 | dstPath = ""; 35 | dstSubfolderSpec = 10; 36 | files = ( 37 | CBB2331D1BC3C1B70079375D /* Himotoki.framework in Embed Frameworks */, 38 | CBB2331F1BC3C1B70079375D /* ReactKit.framework in Embed Frameworks */, 39 | CBB2331B1BC3C1B70079375D /* APIKit.framework in Embed Frameworks */, 40 | CBB233231BC3C1B70079375D /* SwiftTask.framework in Embed Frameworks */, 41 | CBB233211BC3C1B70079375D /* Result.framework in Embed Frameworks */, 42 | ); 43 | name = "Embed Frameworks"; 44 | runOnlyForDeploymentPostprocessing = 0; 45 | }; 46 | /* End PBXCopyFilesBuildPhase section */ 47 | 48 | /* Begin PBXFileReference section */ 49 | CBB232FB1BC3B9560079375D /* ReactKit-APIKit-Himotoki-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ReactKit-APIKit-Himotoki-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | CBB232FE1BC3B9560079375D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 51 | CBB233031BC3B9560079375D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 52 | CBB233051BC3B9560079375D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 53 | CBB233081BC3B9560079375D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 54 | CBB2330A1BC3B9560079375D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | CBB233101BC3C09E0079375D /* Cartfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Cartfile; sourceTree = ""; }; 56 | CBB233131BC3C0F80079375D /* IncrementalSearchViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IncrementalSearchViewController.swift; sourceTree = ""; }; 57 | CBB233151BC3C1B70079375D /* APIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = APIKit.framework; path = Carthage/Build/iOS/APIKit.framework; sourceTree = ""; }; 58 | CBB233161BC3C1B70079375D /* Himotoki.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Himotoki.framework; path = Carthage/Build/iOS/Himotoki.framework; sourceTree = ""; }; 59 | CBB233171BC3C1B70079375D /* ReactKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReactKit.framework; path = Carthage/Build/iOS/ReactKit.framework; sourceTree = ""; }; 60 | CBB233181BC3C1B70079375D /* Result.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Result.framework; path = Carthage/Build/iOS/Result.framework; sourceTree = ""; }; 61 | CBB233191BC3C1B70079375D /* SwiftTask.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftTask.framework; path = Carthage/Build/iOS/SwiftTask.framework; sourceTree = ""; }; 62 | CBB233251BC3C1E20079375D /* QiitaAPI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = QiitaAPI.swift; sourceTree = ""; }; 63 | CBB233271BC3C1FE0079375D /* Session+SwiftTask.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Session+SwiftTask.swift"; sourceTree = ""; }; 64 | /* End PBXFileReference section */ 65 | 66 | /* Begin PBXFrameworksBuildPhase section */ 67 | CBB232F81BC3B9560079375D /* Frameworks */ = { 68 | isa = PBXFrameworksBuildPhase; 69 | buildActionMask = 2147483647; 70 | files = ( 71 | CBB2331C1BC3C1B70079375D /* Himotoki.framework in Frameworks */, 72 | CBB2331E1BC3C1B70079375D /* ReactKit.framework in Frameworks */, 73 | CBB2331A1BC3C1B70079375D /* APIKit.framework in Frameworks */, 74 | CBB233221BC3C1B70079375D /* SwiftTask.framework in Frameworks */, 75 | CBB233201BC3C1B70079375D /* Result.framework in Frameworks */, 76 | ); 77 | runOnlyForDeploymentPostprocessing = 0; 78 | }; 79 | /* End PBXFrameworksBuildPhase section */ 80 | 81 | /* Begin PBXGroup section */ 82 | CBB232F21BC3B9560079375D = { 83 | isa = PBXGroup; 84 | children = ( 85 | CBB233121BC3C0AA0079375D /* Carthage */, 86 | CBB232FD1BC3B9560079375D /* ReactKit-APIKit-Himotoki-sample */, 87 | CBB232FC1BC3B9560079375D /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | CBB232FC1BC3B9560079375D /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | CBB232FB1BC3B9560079375D /* ReactKit-APIKit-Himotoki-sample.app */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | CBB232FD1BC3B9560079375D /* ReactKit-APIKit-Himotoki-sample */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | CBB232FE1BC3B9560079375D /* AppDelegate.swift */, 103 | CBB233131BC3C0F80079375D /* IncrementalSearchViewController.swift */, 104 | CBB233251BC3C1E20079375D /* QiitaAPI.swift */, 105 | CBB233271BC3C1FE0079375D /* Session+SwiftTask.swift */, 106 | CBB233021BC3B9560079375D /* Main.storyboard */, 107 | CBB233051BC3B9560079375D /* Assets.xcassets */, 108 | CBB233071BC3B9560079375D /* LaunchScreen.storyboard */, 109 | CBB2330A1BC3B9560079375D /* Info.plist */, 110 | ); 111 | path = "ReactKit-APIKit-Himotoki-sample"; 112 | sourceTree = ""; 113 | }; 114 | CBB233121BC3C0AA0079375D /* Carthage */ = { 115 | isa = PBXGroup; 116 | children = ( 117 | CBB233101BC3C09E0079375D /* Cartfile */, 118 | CBB233151BC3C1B70079375D /* APIKit.framework */, 119 | CBB233161BC3C1B70079375D /* Himotoki.framework */, 120 | CBB233171BC3C1B70079375D /* ReactKit.framework */, 121 | CBB233181BC3C1B70079375D /* Result.framework */, 122 | CBB233191BC3C1B70079375D /* SwiftTask.framework */, 123 | ); 124 | name = Carthage; 125 | sourceTree = ""; 126 | }; 127 | /* End PBXGroup section */ 128 | 129 | /* Begin PBXNativeTarget section */ 130 | CBB232FA1BC3B9560079375D /* ReactKit-APIKit-Himotoki-sample */ = { 131 | isa = PBXNativeTarget; 132 | buildConfigurationList = CBB2330D1BC3B9560079375D /* Build configuration list for PBXNativeTarget "ReactKit-APIKit-Himotoki-sample" */; 133 | buildPhases = ( 134 | CBB232F71BC3B9560079375D /* Sources */, 135 | CBB232F81BC3B9560079375D /* Frameworks */, 136 | CBB232F91BC3B9560079375D /* Resources */, 137 | CBB233241BC3C1B80079375D /* Embed Frameworks */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = "ReactKit-APIKit-Himotoki-sample"; 144 | productName = "ReactKit-APIKit-Himotoki-sample"; 145 | productReference = CBB232FB1BC3B9560079375D /* ReactKit-APIKit-Himotoki-sample.app */; 146 | productType = "com.apple.product-type.application"; 147 | }; 148 | /* End PBXNativeTarget section */ 149 | 150 | /* Begin PBXProject section */ 151 | CBB232F31BC3B9560079375D /* Project object */ = { 152 | isa = PBXProject; 153 | attributes = { 154 | LastUpgradeCheck = 0700; 155 | ORGANIZATIONNAME = "Shinichiro Oba"; 156 | TargetAttributes = { 157 | CBB232FA1BC3B9560079375D = { 158 | CreatedOnToolsVersion = 7.0.1; 159 | }; 160 | }; 161 | }; 162 | buildConfigurationList = CBB232F61BC3B9560079375D /* Build configuration list for PBXProject "ReactKit-APIKit-Himotoki-sample" */; 163 | compatibilityVersion = "Xcode 3.2"; 164 | developmentRegion = English; 165 | hasScannedForEncodings = 0; 166 | knownRegions = ( 167 | en, 168 | Base, 169 | ); 170 | mainGroup = CBB232F21BC3B9560079375D; 171 | productRefGroup = CBB232FC1BC3B9560079375D /* Products */; 172 | projectDirPath = ""; 173 | projectRoot = ""; 174 | targets = ( 175 | CBB232FA1BC3B9560079375D /* ReactKit-APIKit-Himotoki-sample */, 176 | ); 177 | }; 178 | /* End PBXProject section */ 179 | 180 | /* Begin PBXResourcesBuildPhase section */ 181 | CBB232F91BC3B9560079375D /* Resources */ = { 182 | isa = PBXResourcesBuildPhase; 183 | buildActionMask = 2147483647; 184 | files = ( 185 | CBB233091BC3B9560079375D /* LaunchScreen.storyboard in Resources */, 186 | CBB233061BC3B9560079375D /* Assets.xcassets in Resources */, 187 | CBB233111BC3C09E0079375D /* Cartfile in Resources */, 188 | CBB233041BC3B9560079375D /* Main.storyboard in Resources */, 189 | ); 190 | runOnlyForDeploymentPostprocessing = 0; 191 | }; 192 | /* End PBXResourcesBuildPhase section */ 193 | 194 | /* Begin PBXSourcesBuildPhase section */ 195 | CBB232F71BC3B9560079375D /* Sources */ = { 196 | isa = PBXSourcesBuildPhase; 197 | buildActionMask = 2147483647; 198 | files = ( 199 | CBB233261BC3C1E20079375D /* QiitaAPI.swift in Sources */, 200 | CBB232FF1BC3B9560079375D /* AppDelegate.swift in Sources */, 201 | CBB233141BC3C0F80079375D /* IncrementalSearchViewController.swift in Sources */, 202 | CBB233281BC3C1FE0079375D /* Session+SwiftTask.swift in Sources */, 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | }; 206 | /* End PBXSourcesBuildPhase section */ 207 | 208 | /* Begin PBXVariantGroup section */ 209 | CBB233021BC3B9560079375D /* Main.storyboard */ = { 210 | isa = PBXVariantGroup; 211 | children = ( 212 | CBB233031BC3B9560079375D /* Base */, 213 | ); 214 | name = Main.storyboard; 215 | sourceTree = ""; 216 | }; 217 | CBB233071BC3B9560079375D /* LaunchScreen.storyboard */ = { 218 | isa = PBXVariantGroup; 219 | children = ( 220 | CBB233081BC3B9560079375D /* Base */, 221 | ); 222 | name = LaunchScreen.storyboard; 223 | sourceTree = ""; 224 | }; 225 | /* End PBXVariantGroup section */ 226 | 227 | /* Begin XCBuildConfiguration section */ 228 | CBB2330B1BC3B9560079375D /* Debug */ = { 229 | isa = XCBuildConfiguration; 230 | buildSettings = { 231 | ALWAYS_SEARCH_USER_PATHS = NO; 232 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 233 | CLANG_CXX_LIBRARY = "libc++"; 234 | CLANG_ENABLE_MODULES = YES; 235 | CLANG_ENABLE_OBJC_ARC = YES; 236 | CLANG_WARN_BOOL_CONVERSION = YES; 237 | CLANG_WARN_CONSTANT_CONVERSION = YES; 238 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 239 | CLANG_WARN_EMPTY_BODY = YES; 240 | CLANG_WARN_ENUM_CONVERSION = YES; 241 | CLANG_WARN_INT_CONVERSION = YES; 242 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 243 | CLANG_WARN_UNREACHABLE_CODE = YES; 244 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 245 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 246 | COPY_PHASE_STRIP = NO; 247 | DEBUG_INFORMATION_FORMAT = dwarf; 248 | ENABLE_STRICT_OBJC_MSGSEND = YES; 249 | ENABLE_TESTABILITY = YES; 250 | GCC_C_LANGUAGE_STANDARD = gnu99; 251 | GCC_DYNAMIC_NO_PIC = NO; 252 | GCC_NO_COMMON_BLOCKS = YES; 253 | GCC_OPTIMIZATION_LEVEL = 0; 254 | GCC_PREPROCESSOR_DEFINITIONS = ( 255 | "DEBUG=1", 256 | "$(inherited)", 257 | ); 258 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 259 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 260 | GCC_WARN_UNDECLARED_SELECTOR = YES; 261 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 262 | GCC_WARN_UNUSED_FUNCTION = YES; 263 | GCC_WARN_UNUSED_VARIABLE = YES; 264 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 265 | MTL_ENABLE_DEBUG_INFO = YES; 266 | ONLY_ACTIVE_ARCH = YES; 267 | SDKROOT = iphoneos; 268 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 269 | TARGETED_DEVICE_FAMILY = "1,2"; 270 | }; 271 | name = Debug; 272 | }; 273 | CBB2330C1BC3B9560079375D /* Release */ = { 274 | isa = XCBuildConfiguration; 275 | buildSettings = { 276 | ALWAYS_SEARCH_USER_PATHS = NO; 277 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 278 | CLANG_CXX_LIBRARY = "libc++"; 279 | CLANG_ENABLE_MODULES = YES; 280 | CLANG_ENABLE_OBJC_ARC = YES; 281 | CLANG_WARN_BOOL_CONVERSION = YES; 282 | CLANG_WARN_CONSTANT_CONVERSION = YES; 283 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 284 | CLANG_WARN_EMPTY_BODY = YES; 285 | CLANG_WARN_ENUM_CONVERSION = YES; 286 | CLANG_WARN_INT_CONVERSION = YES; 287 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 288 | CLANG_WARN_UNREACHABLE_CODE = YES; 289 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 290 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 291 | COPY_PHASE_STRIP = NO; 292 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 293 | ENABLE_NS_ASSERTIONS = NO; 294 | ENABLE_STRICT_OBJC_MSGSEND = YES; 295 | GCC_C_LANGUAGE_STANDARD = gnu99; 296 | GCC_NO_COMMON_BLOCKS = YES; 297 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 298 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 299 | GCC_WARN_UNDECLARED_SELECTOR = YES; 300 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 301 | GCC_WARN_UNUSED_FUNCTION = YES; 302 | GCC_WARN_UNUSED_VARIABLE = YES; 303 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 304 | MTL_ENABLE_DEBUG_INFO = NO; 305 | SDKROOT = iphoneos; 306 | TARGETED_DEVICE_FAMILY = "1,2"; 307 | VALIDATE_PRODUCT = YES; 308 | }; 309 | name = Release; 310 | }; 311 | CBB2330E1BC3B9560079375D /* Debug */ = { 312 | isa = XCBuildConfiguration; 313 | buildSettings = { 314 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 315 | CODE_SIGN_IDENTITY = "iPhone Developer"; 316 | FRAMEWORK_SEARCH_PATHS = ( 317 | "$(inherited)", 318 | "$(PROJECT_DIR)/Carthage/Build/iOS", 319 | ); 320 | INFOPLIST_FILE = "ReactKit-APIKit-Himotoki-sample/Info.plist"; 321 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 322 | PRODUCT_BUNDLE_IDENTIFIER = "com.bricklife.ios.ReactKit-APIKit-Himotoki-sample"; 323 | PRODUCT_NAME = "$(TARGET_NAME)"; 324 | }; 325 | name = Debug; 326 | }; 327 | CBB2330F1BC3B9560079375D /* Release */ = { 328 | isa = XCBuildConfiguration; 329 | buildSettings = { 330 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 331 | CODE_SIGN_IDENTITY = "iPhone Developer"; 332 | FRAMEWORK_SEARCH_PATHS = ( 333 | "$(inherited)", 334 | "$(PROJECT_DIR)/Carthage/Build/iOS", 335 | ); 336 | INFOPLIST_FILE = "ReactKit-APIKit-Himotoki-sample/Info.plist"; 337 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 338 | PRODUCT_BUNDLE_IDENTIFIER = "com.bricklife.ios.ReactKit-APIKit-Himotoki-sample"; 339 | PRODUCT_NAME = "$(TARGET_NAME)"; 340 | }; 341 | name = Release; 342 | }; 343 | /* End XCBuildConfiguration section */ 344 | 345 | /* Begin XCConfigurationList section */ 346 | CBB232F61BC3B9560079375D /* Build configuration list for PBXProject "ReactKit-APIKit-Himotoki-sample" */ = { 347 | isa = XCConfigurationList; 348 | buildConfigurations = ( 349 | CBB2330B1BC3B9560079375D /* Debug */, 350 | CBB2330C1BC3B9560079375D /* Release */, 351 | ); 352 | defaultConfigurationIsVisible = 0; 353 | defaultConfigurationName = Release; 354 | }; 355 | CBB2330D1BC3B9560079375D /* Build configuration list for PBXNativeTarget "ReactKit-APIKit-Himotoki-sample" */ = { 356 | isa = XCConfigurationList; 357 | buildConfigurations = ( 358 | CBB2330E1BC3B9560079375D /* Debug */, 359 | CBB2330F1BC3B9560079375D /* Release */, 360 | ); 361 | defaultConfigurationIsVisible = 0; 362 | defaultConfigurationName = Release; 363 | }; 364 | /* End XCConfigurationList section */ 365 | }; 366 | rootObject = CBB232F31BC3B9560079375D /* Project object */; 367 | } 368 | -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // ReactKit-APIKit-Himotoki-sample 4 | // 5 | // Created by Shinichiro Oba on 2015/10/06. 6 | // Copyright © 2015年 Shinichiro Oba. 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 | -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample/Assets.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 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample/Base.lproj/LaunchScreen.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 | 27 | 28 | -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample/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 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 41 | 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 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample/IncrementalSearchViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // IncrementalSearchViewController.swift 3 | // ReactKit-APIKit-Himotoki-sample 4 | // 5 | // Created by Shinichiro Oba on 2015/10/06. 6 | // Copyright © 2015年 Shinichiro Oba. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import ReactKit 11 | import APIKit 12 | import SafariServices 13 | 14 | class IncrementalSearchViewController: UITableViewController { 15 | 16 | @IBOutlet weak var searchBar: UISearchBar! 17 | 18 | dynamic var searchText: String = "" 19 | 20 | var searchResultStream: Stream<[Item]>? 21 | var items: [Item] = [] 22 | 23 | let dateFormatter = NSDateFormatter() 24 | 25 | override func viewDidLoad() { 26 | super.viewDidLoad() 27 | 28 | self.tableView.rowHeight = UITableViewAutomaticDimension 29 | self.tableView.estimatedRowHeight = 44 30 | 31 | self.dateFormatter.locale = NSLocale.currentLocale() 32 | self.dateFormatter.timeZone = NSTimeZone.localTimeZone() 33 | self.dateFormatter.dateStyle = .ShortStyle 34 | self.dateFormatter.timeStyle = .ShortStyle 35 | 36 | bind() 37 | 38 | self.searchBar.becomeFirstResponder() 39 | } 40 | 41 | func bind() { 42 | self.searchResultStream = KVO.stream(self, "searchText") 43 | |> debounce(0.5) 44 | |> map { ($0 as? String) ?? "" } 45 | |> distinctUntilChanged 46 | |> map { query -> Stream<[Item]> in 47 | if query.isEmpty { 48 | return Stream<[Item]>.just([]) 49 | } 50 | 51 | let request = GetItemsRequest(query: query) 52 | return Stream<[Item]>.fromTask(Session.taskFromRequest(request)) 53 | } 54 | |> switchLatestInner 55 | 56 | self.searchResultStream! ~> { [weak self] items in 57 | print(items.count) 58 | self?.items = items 59 | self?.tableView.reloadData() 60 | } 61 | } 62 | 63 | // MARK: - UITableViewDataSource 64 | 65 | override func numberOfSectionsInTableView(tableView: UITableView) -> Int { 66 | return 1 67 | } 68 | 69 | override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 70 | return items.count 71 | } 72 | 73 | override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 74 | let cell = tableView.dequeueReusableCellWithIdentifier("Item", forIndexPath: indexPath) 75 | 76 | let item = self.items[indexPath.row] 77 | cell.textLabel?.text = item.title 78 | cell.detailTextLabel?.text = "\(self.dateFormatter.stringFromDate(item.createdAt)) に \(item.userId) が投稿" 79 | 80 | return cell 81 | } 82 | 83 | // MARK: - UITableViewDelegate 84 | 85 | override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 86 | let item = self.items[indexPath.row] 87 | let vc = SFSafariViewController(URL: item.url) 88 | 89 | self.navigationController?.pushViewController(vc, animated: true) 90 | } 91 | 92 | // MARK: - UISearchBarDelegate 93 | 94 | func searchBar(searchBar: UISearchBar, textDidChange searchText: String) { 95 | self.searchText = searchText 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 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 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample/QiitaAPI.swift: -------------------------------------------------------------------------------- 1 | // 2 | // QiitaAPI.swift 3 | // ReactKit-APIKit-Himotoki-sample 4 | // 5 | // Created by Shinichiro Oba on 2015/10/06. 6 | // Copyright © 2015年 Shinichiro Oba. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import APIKit 11 | import Himotoki 12 | 13 | protocol QiitaRequest: RequestType { 14 | } 15 | 16 | extension QiitaRequest { 17 | var baseURL: NSURL { 18 | return NSURL(string: "https://qiita.com/api/v2")! 19 | } 20 | } 21 | 22 | struct GetItemsRequest: QiitaRequest { 23 | typealias Response = [Item] 24 | 25 | let query: String 26 | 27 | init(query: String) { 28 | self.query = query 29 | } 30 | 31 | var method: HTTPMethod { 32 | return .GET 33 | } 34 | 35 | var path: String { 36 | return "/items" 37 | } 38 | 39 | var parameters: [String: AnyObject] { 40 | return [ 41 | "page": "1", 42 | "per_page": "20", 43 | "query": self.query, 44 | ] 45 | } 46 | 47 | func responseFromObject(object: AnyObject, URLResponse: NSHTTPURLResponse) -> Response? { 48 | return try? decodeArray(object) 49 | } 50 | } 51 | 52 | struct Item: Decodable { 53 | let title: String 54 | let createdAt: NSDate 55 | let url: NSURL 56 | let userId: String 57 | 58 | static func decode(e: Extractor) throws -> Item { 59 | return try build(self.init)( 60 | e <| "title", 61 | dateFromString(e <| "created_at"), 62 | e <| "url", 63 | e <| ["user", "id"] 64 | ) 65 | } 66 | 67 | private static func dateFromString(string: String) throws -> NSDate { 68 | let dateFormatter = NSDateFormatter() 69 | dateFormatter.locale = NSLocale(localeIdentifier: "en_US_POSIX") 70 | dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" 71 | 72 | guard let result = dateFormatter.dateFromString(string) else { 73 | throw ConvertError.InvalidParameter(type: "\(self)", from: string) 74 | } 75 | 76 | return result 77 | } 78 | } 79 | 80 | extension NSURL: Decodable { 81 | public static func decode(e: Extractor) throws -> NSURL { 82 | let rawValue = try String.decode(e) 83 | 84 | guard let result = NSURL(string: rawValue) else { 85 | throw ConvertError.InvalidParameter(type: "\(self)", from: rawValue) 86 | } 87 | 88 | return result 89 | } 90 | } 91 | 92 | public enum ConvertError: ErrorType { 93 | case InvalidParameter(type: String, from: String) 94 | } 95 | -------------------------------------------------------------------------------- /ReactKit-APIKit-Himotoki-sample/Session+SwiftTask.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Session+SwiftTask.swift 3 | // ReactKit-APIKit-Himotoki-sample 4 | // 5 | // Created by Shinichiro Oba on 2015/10/06. 6 | // Copyright © 2015年 Shinichiro Oba. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | import APIKit 11 | import SwiftTask 12 | 13 | extension Session { 14 | static func taskFromRequest(request: T) -> Task { 15 | return Task { fulfill, reject in 16 | self.sendRequest(request) { result in 17 | switch result { 18 | case .Success(let response): 19 | fulfill(response) 20 | case .Failure(let error): 21 | reject(error) 22 | } 23 | } 24 | } 25 | } 26 | } --------------------------------------------------------------------------------