├── BlockTableView-Swift.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── BlockTableView-Swift.xccheckout │ └── xcuserdata │ │ └── cem.xcuserdatad │ │ ├── UserInterfaceState.xcuserstate │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── cem.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── BlockTableView-Swift.xcscheme │ └── xcschememanagement.plist ├── BlockTableView-Swift ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── BlockTableView.swift ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist └── ViewController.swift ├── BlockTableView-SwiftTests ├── BlockTableView_SwiftTests.swift └── Info.plist ├── BlockTableView.podspec ├── LICENSE └── README.md /BlockTableView-Swift.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B24AF9F11A136E1900739AF5 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B24AF9F01A136E1900739AF5 /* AppDelegate.swift */; }; 11 | B24AF9F31A136E1900739AF5 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B24AF9F21A136E1900739AF5 /* ViewController.swift */; }; 12 | B24AF9F61A136E1900739AF5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B24AF9F41A136E1900739AF5 /* Main.storyboard */; }; 13 | B24AF9F81A136E1900739AF5 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B24AF9F71A136E1900739AF5 /* Images.xcassets */; }; 14 | B24AF9FB1A136E1900739AF5 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = B24AF9F91A136E1900739AF5 /* LaunchScreen.xib */; }; 15 | B24AFA071A136E1900739AF5 /* BlockTableView_SwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B24AFA061A136E1900739AF5 /* BlockTableView_SwiftTests.swift */; }; 16 | B24AFA111A136E3100739AF5 /* BlockTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B24AFA101A136E3100739AF5 /* BlockTableView.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXContainerItemProxy section */ 20 | B24AFA011A136E1900739AF5 /* PBXContainerItemProxy */ = { 21 | isa = PBXContainerItemProxy; 22 | containerPortal = B24AF9E31A136E1900739AF5 /* Project object */; 23 | proxyType = 1; 24 | remoteGlobalIDString = B24AF9EA1A136E1900739AF5; 25 | remoteInfo = "BlockTableView-Swift"; 26 | }; 27 | /* End PBXContainerItemProxy section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | B24AF9EB1A136E1900739AF5 /* BlockTableView-Swift.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "BlockTableView-Swift.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | B24AF9EF1A136E1900739AF5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 32 | B24AF9F01A136E1900739AF5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33 | B24AF9F21A136E1900739AF5 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 34 | B24AF9F51A136E1900739AF5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 35 | B24AF9F71A136E1900739AF5 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 36 | B24AF9FA1A136E1900739AF5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 37 | B24AFA001A136E1900739AF5 /* BlockTableView-SwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "BlockTableView-SwiftTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 38 | B24AFA051A136E1900739AF5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 39 | B24AFA061A136E1900739AF5 /* BlockTableView_SwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockTableView_SwiftTests.swift; sourceTree = ""; }; 40 | B24AFA101A136E3100739AF5 /* BlockTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlockTableView.swift; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | B24AF9E81A136E1900739AF5 /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | ); 49 | runOnlyForDeploymentPostprocessing = 0; 50 | }; 51 | B24AF9FD1A136E1900739AF5 /* Frameworks */ = { 52 | isa = PBXFrameworksBuildPhase; 53 | buildActionMask = 2147483647; 54 | files = ( 55 | ); 56 | runOnlyForDeploymentPostprocessing = 0; 57 | }; 58 | /* End PBXFrameworksBuildPhase section */ 59 | 60 | /* Begin PBXGroup section */ 61 | B24AF9E21A136E1900739AF5 = { 62 | isa = PBXGroup; 63 | children = ( 64 | B24AF9ED1A136E1900739AF5 /* BlockTableView-Swift */, 65 | B24AFA031A136E1900739AF5 /* BlockTableView-SwiftTests */, 66 | B24AF9EC1A136E1900739AF5 /* Products */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | B24AF9EC1A136E1900739AF5 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | B24AF9EB1A136E1900739AF5 /* BlockTableView-Swift.app */, 74 | B24AFA001A136E1900739AF5 /* BlockTableView-SwiftTests.xctest */, 75 | ); 76 | name = Products; 77 | sourceTree = ""; 78 | }; 79 | B24AF9ED1A136E1900739AF5 /* BlockTableView-Swift */ = { 80 | isa = PBXGroup; 81 | children = ( 82 | B24AF9F01A136E1900739AF5 /* AppDelegate.swift */, 83 | B24AF9F21A136E1900739AF5 /* ViewController.swift */, 84 | B24AFA101A136E3100739AF5 /* BlockTableView.swift */, 85 | B24AF9F41A136E1900739AF5 /* Main.storyboard */, 86 | B24AF9F71A136E1900739AF5 /* Images.xcassets */, 87 | B24AF9F91A136E1900739AF5 /* LaunchScreen.xib */, 88 | B24AF9EE1A136E1900739AF5 /* Supporting Files */, 89 | ); 90 | path = "BlockTableView-Swift"; 91 | sourceTree = ""; 92 | }; 93 | B24AF9EE1A136E1900739AF5 /* Supporting Files */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | B24AF9EF1A136E1900739AF5 /* Info.plist */, 97 | ); 98 | name = "Supporting Files"; 99 | sourceTree = ""; 100 | }; 101 | B24AFA031A136E1900739AF5 /* BlockTableView-SwiftTests */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | B24AFA061A136E1900739AF5 /* BlockTableView_SwiftTests.swift */, 105 | B24AFA041A136E1900739AF5 /* Supporting Files */, 106 | ); 107 | path = "BlockTableView-SwiftTests"; 108 | sourceTree = ""; 109 | }; 110 | B24AFA041A136E1900739AF5 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | B24AFA051A136E1900739AF5 /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | /* End PBXGroup section */ 119 | 120 | /* Begin PBXNativeTarget section */ 121 | B24AF9EA1A136E1900739AF5 /* BlockTableView-Swift */ = { 122 | isa = PBXNativeTarget; 123 | buildConfigurationList = B24AFA0A1A136E1900739AF5 /* Build configuration list for PBXNativeTarget "BlockTableView-Swift" */; 124 | buildPhases = ( 125 | B24AF9E71A136E1900739AF5 /* Sources */, 126 | B24AF9E81A136E1900739AF5 /* Frameworks */, 127 | B24AF9E91A136E1900739AF5 /* Resources */, 128 | ); 129 | buildRules = ( 130 | ); 131 | dependencies = ( 132 | ); 133 | name = "BlockTableView-Swift"; 134 | productName = "BlockTableView-Swift"; 135 | productReference = B24AF9EB1A136E1900739AF5 /* BlockTableView-Swift.app */; 136 | productType = "com.apple.product-type.application"; 137 | }; 138 | B24AF9FF1A136E1900739AF5 /* BlockTableView-SwiftTests */ = { 139 | isa = PBXNativeTarget; 140 | buildConfigurationList = B24AFA0D1A136E1900739AF5 /* Build configuration list for PBXNativeTarget "BlockTableView-SwiftTests" */; 141 | buildPhases = ( 142 | B24AF9FC1A136E1900739AF5 /* Sources */, 143 | B24AF9FD1A136E1900739AF5 /* Frameworks */, 144 | B24AF9FE1A136E1900739AF5 /* Resources */, 145 | ); 146 | buildRules = ( 147 | ); 148 | dependencies = ( 149 | B24AFA021A136E1900739AF5 /* PBXTargetDependency */, 150 | ); 151 | name = "BlockTableView-SwiftTests"; 152 | productName = "BlockTableView-SwiftTests"; 153 | productReference = B24AFA001A136E1900739AF5 /* BlockTableView-SwiftTests.xctest */; 154 | productType = "com.apple.product-type.bundle.unit-test"; 155 | }; 156 | /* End PBXNativeTarget section */ 157 | 158 | /* Begin PBXProject section */ 159 | B24AF9E31A136E1900739AF5 /* Project object */ = { 160 | isa = PBXProject; 161 | attributes = { 162 | LastUpgradeCheck = 0610; 163 | ORGANIZATIONNAME = "Cem Olcay"; 164 | TargetAttributes = { 165 | B24AF9EA1A136E1900739AF5 = { 166 | CreatedOnToolsVersion = 6.1; 167 | }; 168 | B24AF9FF1A136E1900739AF5 = { 169 | CreatedOnToolsVersion = 6.1; 170 | TestTargetID = B24AF9EA1A136E1900739AF5; 171 | }; 172 | }; 173 | }; 174 | buildConfigurationList = B24AF9E61A136E1900739AF5 /* Build configuration list for PBXProject "BlockTableView-Swift" */; 175 | compatibilityVersion = "Xcode 3.2"; 176 | developmentRegion = English; 177 | hasScannedForEncodings = 0; 178 | knownRegions = ( 179 | en, 180 | Base, 181 | ); 182 | mainGroup = B24AF9E21A136E1900739AF5; 183 | productRefGroup = B24AF9EC1A136E1900739AF5 /* Products */; 184 | projectDirPath = ""; 185 | projectRoot = ""; 186 | targets = ( 187 | B24AF9EA1A136E1900739AF5 /* BlockTableView-Swift */, 188 | B24AF9FF1A136E1900739AF5 /* BlockTableView-SwiftTests */, 189 | ); 190 | }; 191 | /* End PBXProject section */ 192 | 193 | /* Begin PBXResourcesBuildPhase section */ 194 | B24AF9E91A136E1900739AF5 /* Resources */ = { 195 | isa = PBXResourcesBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | B24AF9F61A136E1900739AF5 /* Main.storyboard in Resources */, 199 | B24AF9FB1A136E1900739AF5 /* LaunchScreen.xib in Resources */, 200 | B24AF9F81A136E1900739AF5 /* Images.xcassets in Resources */, 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | }; 204 | B24AF9FE1A136E1900739AF5 /* Resources */ = { 205 | isa = PBXResourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | }; 211 | /* End PBXResourcesBuildPhase section */ 212 | 213 | /* Begin PBXSourcesBuildPhase section */ 214 | B24AF9E71A136E1900739AF5 /* Sources */ = { 215 | isa = PBXSourcesBuildPhase; 216 | buildActionMask = 2147483647; 217 | files = ( 218 | B24AF9F31A136E1900739AF5 /* ViewController.swift in Sources */, 219 | B24AF9F11A136E1900739AF5 /* AppDelegate.swift in Sources */, 220 | B24AFA111A136E3100739AF5 /* BlockTableView.swift in Sources */, 221 | ); 222 | runOnlyForDeploymentPostprocessing = 0; 223 | }; 224 | B24AF9FC1A136E1900739AF5 /* Sources */ = { 225 | isa = PBXSourcesBuildPhase; 226 | buildActionMask = 2147483647; 227 | files = ( 228 | B24AFA071A136E1900739AF5 /* BlockTableView_SwiftTests.swift in Sources */, 229 | ); 230 | runOnlyForDeploymentPostprocessing = 0; 231 | }; 232 | /* End PBXSourcesBuildPhase section */ 233 | 234 | /* Begin PBXTargetDependency section */ 235 | B24AFA021A136E1900739AF5 /* PBXTargetDependency */ = { 236 | isa = PBXTargetDependency; 237 | target = B24AF9EA1A136E1900739AF5 /* BlockTableView-Swift */; 238 | targetProxy = B24AFA011A136E1900739AF5 /* PBXContainerItemProxy */; 239 | }; 240 | /* End PBXTargetDependency section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | B24AF9F41A136E1900739AF5 /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | B24AF9F51A136E1900739AF5 /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | B24AF9F91A136E1900739AF5 /* LaunchScreen.xib */ = { 252 | isa = PBXVariantGroup; 253 | children = ( 254 | B24AF9FA1A136E1900739AF5 /* Base */, 255 | ); 256 | name = LaunchScreen.xib; 257 | sourceTree = ""; 258 | }; 259 | /* End PBXVariantGroup section */ 260 | 261 | /* Begin XCBuildConfiguration section */ 262 | B24AFA081A136E1900739AF5 /* Debug */ = { 263 | isa = XCBuildConfiguration; 264 | buildSettings = { 265 | ALWAYS_SEARCH_USER_PATHS = NO; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BOOL_CONVERSION = YES; 271 | CLANG_WARN_CONSTANT_CONVERSION = YES; 272 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 273 | CLANG_WARN_EMPTY_BODY = YES; 274 | CLANG_WARN_ENUM_CONVERSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 277 | CLANG_WARN_UNREACHABLE_CODE = YES; 278 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 279 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 280 | COPY_PHASE_STRIP = NO; 281 | ENABLE_STRICT_OBJC_MSGSEND = YES; 282 | GCC_C_LANGUAGE_STANDARD = gnu99; 283 | GCC_DYNAMIC_NO_PIC = NO; 284 | GCC_OPTIMIZATION_LEVEL = 0; 285 | GCC_PREPROCESSOR_DEFINITIONS = ( 286 | "DEBUG=1", 287 | "$(inherited)", 288 | ); 289 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 290 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 291 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 292 | GCC_WARN_UNDECLARED_SELECTOR = YES; 293 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 294 | GCC_WARN_UNUSED_FUNCTION = YES; 295 | GCC_WARN_UNUSED_VARIABLE = YES; 296 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 297 | MTL_ENABLE_DEBUG_INFO = YES; 298 | ONLY_ACTIVE_ARCH = YES; 299 | SDKROOT = iphoneos; 300 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 301 | }; 302 | name = Debug; 303 | }; 304 | B24AFA091A136E1900739AF5 /* Release */ = { 305 | isa = XCBuildConfiguration; 306 | buildSettings = { 307 | ALWAYS_SEARCH_USER_PATHS = NO; 308 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 309 | CLANG_CXX_LIBRARY = "libc++"; 310 | CLANG_ENABLE_MODULES = YES; 311 | CLANG_ENABLE_OBJC_ARC = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_CONSTANT_CONVERSION = YES; 314 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 315 | CLANG_WARN_EMPTY_BODY = YES; 316 | CLANG_WARN_ENUM_CONVERSION = YES; 317 | CLANG_WARN_INT_CONVERSION = YES; 318 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 319 | CLANG_WARN_UNREACHABLE_CODE = YES; 320 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 321 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 322 | COPY_PHASE_STRIP = YES; 323 | ENABLE_NS_ASSERTIONS = NO; 324 | ENABLE_STRICT_OBJC_MSGSEND = YES; 325 | GCC_C_LANGUAGE_STANDARD = gnu99; 326 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 327 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 328 | GCC_WARN_UNDECLARED_SELECTOR = YES; 329 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 330 | GCC_WARN_UNUSED_FUNCTION = YES; 331 | GCC_WARN_UNUSED_VARIABLE = YES; 332 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 333 | MTL_ENABLE_DEBUG_INFO = NO; 334 | SDKROOT = iphoneos; 335 | VALIDATE_PRODUCT = YES; 336 | }; 337 | name = Release; 338 | }; 339 | B24AFA0B1A136E1900739AF5 /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 343 | INFOPLIST_FILE = "BlockTableView-Swift/Info.plist"; 344 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 345 | PRODUCT_NAME = "$(TARGET_NAME)"; 346 | }; 347 | name = Debug; 348 | }; 349 | B24AFA0C1A136E1900739AF5 /* Release */ = { 350 | isa = XCBuildConfiguration; 351 | buildSettings = { 352 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 353 | INFOPLIST_FILE = "BlockTableView-Swift/Info.plist"; 354 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 355 | PRODUCT_NAME = "$(TARGET_NAME)"; 356 | }; 357 | name = Release; 358 | }; 359 | B24AFA0E1A136E1900739AF5 /* Debug */ = { 360 | isa = XCBuildConfiguration; 361 | buildSettings = { 362 | BUNDLE_LOADER = "$(TEST_HOST)"; 363 | FRAMEWORK_SEARCH_PATHS = ( 364 | "$(SDKROOT)/Developer/Library/Frameworks", 365 | "$(inherited)", 366 | ); 367 | GCC_PREPROCESSOR_DEFINITIONS = ( 368 | "DEBUG=1", 369 | "$(inherited)", 370 | ); 371 | INFOPLIST_FILE = "BlockTableView-SwiftTests/Info.plist"; 372 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 373 | PRODUCT_NAME = "$(TARGET_NAME)"; 374 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BlockTableView-Swift.app/BlockTableView-Swift"; 375 | }; 376 | name = Debug; 377 | }; 378 | B24AFA0F1A136E1900739AF5 /* Release */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | BUNDLE_LOADER = "$(TEST_HOST)"; 382 | FRAMEWORK_SEARCH_PATHS = ( 383 | "$(SDKROOT)/Developer/Library/Frameworks", 384 | "$(inherited)", 385 | ); 386 | INFOPLIST_FILE = "BlockTableView-SwiftTests/Info.plist"; 387 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 388 | PRODUCT_NAME = "$(TARGET_NAME)"; 389 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BlockTableView-Swift.app/BlockTableView-Swift"; 390 | }; 391 | name = Release; 392 | }; 393 | /* End XCBuildConfiguration section */ 394 | 395 | /* Begin XCConfigurationList section */ 396 | B24AF9E61A136E1900739AF5 /* Build configuration list for PBXProject "BlockTableView-Swift" */ = { 397 | isa = XCConfigurationList; 398 | buildConfigurations = ( 399 | B24AFA081A136E1900739AF5 /* Debug */, 400 | B24AFA091A136E1900739AF5 /* Release */, 401 | ); 402 | defaultConfigurationIsVisible = 0; 403 | defaultConfigurationName = Release; 404 | }; 405 | B24AFA0A1A136E1900739AF5 /* Build configuration list for PBXNativeTarget "BlockTableView-Swift" */ = { 406 | isa = XCConfigurationList; 407 | buildConfigurations = ( 408 | B24AFA0B1A136E1900739AF5 /* Debug */, 409 | B24AFA0C1A136E1900739AF5 /* Release */, 410 | ); 411 | defaultConfigurationIsVisible = 0; 412 | }; 413 | B24AFA0D1A136E1900739AF5 /* Build configuration list for PBXNativeTarget "BlockTableView-SwiftTests" */ = { 414 | isa = XCConfigurationList; 415 | buildConfigurations = ( 416 | B24AFA0E1A136E1900739AF5 /* Debug */, 417 | B24AFA0F1A136E1900739AF5 /* Release */, 418 | ); 419 | defaultConfigurationIsVisible = 0; 420 | }; 421 | /* End XCConfigurationList section */ 422 | }; 423 | rootObject = B24AF9E31A136E1900739AF5 /* Project object */; 424 | } 425 | -------------------------------------------------------------------------------- /BlockTableView-Swift.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BlockTableView-Swift.xcodeproj/project.xcworkspace/xcshareddata/BlockTableView-Swift.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 24F1053F-B321-4DC9-A2D7-9B1648E15367 9 | IDESourceControlProjectName 10 | BlockTableView-Swift 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 4D52A7D5FC5979B90BD7A0019B2975B60C1F20BC 14 | https://github.com/cemolcay/BlockTableView-Swift.git 15 | 16 | IDESourceControlProjectPath 17 | BlockTableView-Swift.xcodeproj 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 4D52A7D5FC5979B90BD7A0019B2975B60C1F20BC 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/cemolcay/BlockTableView-Swift.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | 4D52A7D5FC5979B90BD7A0019B2975B60C1F20BC 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 4D52A7D5FC5979B90BD7A0019B2975B60C1F20BC 36 | IDESourceControlWCCName 37 | BlockTableView-Swift 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /BlockTableView-Swift.xcodeproj/project.xcworkspace/xcuserdata/cem.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cemolcay/BlockTableView-Swift/a97036f675f62ae89437d6a5eeaae7c595c121b6/BlockTableView-Swift.xcodeproj/project.xcworkspace/xcuserdata/cem.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /BlockTableView-Swift.xcodeproj/project.xcworkspace/xcuserdata/cem.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges 6 | 7 | SnapshotAutomaticallyBeforeSignificantChanges 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /BlockTableView-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /BlockTableView-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcschemes/BlockTableView-Swift.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 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 94 | 100 | 101 | 102 | 103 | 105 | 106 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /BlockTableView-Swift.xcodeproj/xcuserdata/cem.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | BlockTableView-Swift.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | B24AF9EA1A136E1900739AF5 16 | 17 | primary 18 | 19 | 20 | B24AF9FF1A136E1900739AF5 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /BlockTableView-Swift/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // BlockTableView-Swift 4 | // 5 | // Created by Cem Olcay on 12/11/14. 6 | // Copyright (c) 2014 Cem Olcay. 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 | -------------------------------------------------------------------------------- /BlockTableView-Swift/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 | -------------------------------------------------------------------------------- /BlockTableView-Swift/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 | -------------------------------------------------------------------------------- /BlockTableView-Swift/BlockTableView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BlockTableView.swift 3 | // BlockTableView-Swift 4 | // 5 | // Created by Cem Olcay on 12/11/14. 6 | // Copyright (c) 2014 Cem Olcay. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class BlockTableViewController: UITableViewController { 12 | 13 | init (blockTableView: BlockTableView) { 14 | super.init(style: .Plain) 15 | tableView = blockTableView 16 | } 17 | 18 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) { 19 | super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) 20 | } 21 | 22 | required init(coder aDecoder: NSCoder) { 23 | super.init(coder: aDecoder) 24 | } 25 | } 26 | 27 | class BlockTableView: UITableView, UITableViewDelegate, UITableViewDataSource, UISearchResultsUpdating { 28 | 29 | 30 | // MARK: Init 31 | 32 | required init(coder aDecoder: NSCoder) { 33 | super.init(coder: aDecoder) 34 | } 35 | 36 | 37 | convenience init(frame: CGRect, 38 | numberOfRowsInSection : (section: Int) -> Int, 39 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 40 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) { 41 | 42 | self.init (frame: frame, 43 | registeredCells: ["Cell": UITableViewCell.self], 44 | numberOfSections: 1, 45 | titleForHeaderInSection: nil, 46 | numberOfRowsInSection: numberOfRowsInSection, 47 | cellForRowAtIndexPath: cellForRowAtIndexPath, 48 | didSelectRowAtIndexPath: didSelectRowAtIndexPath) 49 | } 50 | 51 | 52 | convenience init(frame: CGRect, 53 | numberOfSections : Int, 54 | titleForHeaderInSection : (section: Int) -> String, 55 | numberOfRowsInSection : (section: Int) -> Int, 56 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 57 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) { 58 | 59 | self.init (frame: frame, 60 | registeredCells: ["Cell": UITableViewCell.self], 61 | numberOfSections: numberOfSections, 62 | titleForHeaderInSection: titleForHeaderInSection, 63 | numberOfRowsInSection: numberOfRowsInSection, 64 | cellForRowAtIndexPath: cellForRowAtIndexPath, 65 | didSelectRowAtIndexPath: didSelectRowAtIndexPath) 66 | } 67 | 68 | 69 | convenience init(frame: CGRect, 70 | registeredCells : [String: AnyClass], 71 | numberOfRowsInSection : (section: Int) -> Int, 72 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 73 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) { 74 | 75 | self.init (frame: frame, 76 | registeredCells: registeredCells, 77 | numberOfSections: 1, 78 | titleForHeaderInSection: nil, 79 | numberOfRowsInSection: numberOfRowsInSection, 80 | cellForRowAtIndexPath: cellForRowAtIndexPath, 81 | didSelectRowAtIndexPath: didSelectRowAtIndexPath) 82 | } 83 | 84 | 85 | init(frame: CGRect, 86 | registeredCells : [String: AnyClass]?, 87 | numberOfSections : Int?, 88 | titleForHeaderInSection : ((section: Int) -> String)?, 89 | numberOfRowsInSection : (section: Int) -> Int, 90 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 91 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) { 92 | 93 | self.registeredCells = registeredCells 94 | self.numberOfSections = numberOfSections 95 | self.numberOfRowsInSection = numberOfRowsInSection 96 | self.titleForHeaderInSection = titleForHeaderInSection 97 | self.cellForRowAtIndexPath = cellForRowAtIndexPath 98 | self.didSelectRowAtIndexPath = didSelectRowAtIndexPath 99 | 100 | super.init(frame: frame, style: UITableViewStyle.Plain) 101 | dataSource = self 102 | delegate = self 103 | 104 | estimatedRowHeight = 60 105 | rowHeight = UITableViewAutomaticDimension 106 | 107 | for (key, value) in registeredCells! { 108 | registerClass(value, forCellReuseIdentifier: key) 109 | } 110 | } 111 | 112 | 113 | 114 | // MARK: Block 115 | 116 | var registeredCells : [String: AnyClass]? 117 | var numberOfSections : Int? 118 | var titleForHeaderInSection : ((Int)->String)? 119 | var numberOfRowsInSection : ((Int)->Int)? 120 | var cellForRowAtIndexPath : ((UITableView, NSIndexPath)->UITableViewCell)? 121 | var didSelectRowAtIndexPath : ((UITableView, NSIndexPath)->())? 122 | 123 | 124 | 125 | // MARK: - UITableViewDataSource 126 | 127 | func numberOfSectionsInTableView(tableView: UITableView) -> Int { 128 | return numberOfSections! 129 | } 130 | 131 | func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 132 | return numberOfRowsInSection! (section) 133 | } 134 | 135 | func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { 136 | return cellForRowAtIndexPath! (tableView, indexPath) 137 | } 138 | 139 | func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? { 140 | if let title = titleForHeaderInSection? (section) { 141 | return title 142 | } 143 | else { 144 | return "" 145 | } 146 | } 147 | 148 | 149 | 150 | // MARK: UITableViewDelegate 151 | 152 | func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { 153 | didSelectRowAtIndexPath! (tableView, indexPath) 154 | } 155 | 156 | 157 | 158 | // MARK: - Search 159 | 160 | var searchController: UISearchController? 161 | var searchResultsViewController: BlockTableViewController? 162 | var didSearchTextChanged: ((String)->Void)? 163 | 164 | func addSearchBar (searchResultTableView tableView: BlockTableView, didSearch: (String)->()) { 165 | 166 | didSearchTextChanged = didSearch 167 | searchResultsViewController = BlockTableViewController (blockTableView: tableView) 168 | 169 | searchController = UISearchController(searchResultsController: searchResultsViewController) 170 | searchController?.searchResultsUpdater = self 171 | searchController?.searchBar.sizeToFit() 172 | tableHeaderView = searchController?.searchBar 173 | } 174 | 175 | 176 | 177 | // MARK: UISearchResultsUpdatingDelegate 178 | 179 | func updateSearchResultsForSearchController(searchController: UISearchController) { 180 | didSearchTextChanged? (searchController.searchBar.text) 181 | searchResultsViewController?.tableView.reloadData() 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /BlockTableView-Swift/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 | } -------------------------------------------------------------------------------- /BlockTableView-Swift/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.questa.$(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 | -------------------------------------------------------------------------------- /BlockTableView-Swift/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // BlockTableView-Swift 4 | // 5 | // Created by Cem Olcay on 12/11/14. 6 | // Copyright (c) 2014 Cem Olcay. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | 16 | createSingleSectionTableView() 17 | //createMultiSectionTableView() 18 | } 19 | 20 | func createSingleSectionTableView () { 21 | 22 | // Setup data source 23 | var dataSource : [String] = [] 24 | for i in 1...20 { 25 | dataSource.append("cell \(i)") 26 | } 27 | 28 | 29 | // Create BlockTableView 30 | let table = BlockTableView (frame: self.view.frame, 31 | registeredCells: ["asd": UITableViewCell.self], 32 | numberOfRowsInSection: { (section) -> Int in 33 | return dataSource.count 34 | }, 35 | cellForRowAtIndexPath: { (tableView, indexPath) -> UITableViewCell in 36 | var cell = tableView.dequeueReusableCellWithIdentifier("asd", forIndexPath: indexPath) as UITableViewCell 37 | 38 | let current = dataSource[indexPath.row] 39 | cell.textLabel?.text = current 40 | cell.textLabel?.numberOfLines = 0 41 | 42 | return cell 43 | }, 44 | didSelectRowAtIndexPath: { (tableView, indexPath) -> () in 45 | tableView.deselectRowAtIndexPath(indexPath, animated: true) 46 | 47 | let selected = dataSource[indexPath.row] 48 | println("\(selected) selected") 49 | } 50 | ) 51 | 52 | // add a search bar 53 | var filtered: [String]! // search result dataSource 54 | 55 | table.addSearchBar(searchResultTableView: 56 | BlockTableView (frame: self.view.frame, 57 | numberOfRowsInSection: { (section) -> Int in 58 | return filtered.count 59 | }, 60 | cellForRowAtIndexPath: { (tableView, indexPath) -> UITableViewCell in 61 | var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell 62 | cell.textLabel?.text = filtered[indexPath.row] 63 | return cell 64 | }, 65 | didSelectRowAtIndexPath: { (tableView, indexPath) -> () in 66 | return 67 | } 68 | ), didSearch: { searchText in 69 | filtered = filter (dataSource) { $0.rangeOfString(searchText) != nil } 70 | } 71 | ) 72 | 73 | 74 | // Add table to view 75 | self.view.addSubview(table) 76 | } 77 | 78 | func createMultiSectionTableView () { 79 | 80 | // Setup data source 81 | var dataSource : [String:[String]] = [ 82 | "Section 1":["Cell 1", "Cell 2", "Cell 3", "Cell 4"], 83 | "Section 2":["Cell 1", "Cell 2", "Cell 3", "Cell 4", "Cell 5"], 84 | "Section 3":["Cell 1", "Cell 2", "Cell 3"] 85 | ] 86 | 87 | // Create BlockTableView 88 | let table = BlockTableView (frame: self.view.frame, 89 | numberOfSections: dataSource.count, 90 | titleForHeaderInSection: { (section) -> String in 91 | return dataSource.keys.array[section] 92 | }, 93 | numberOfRowsInSection: { (section) -> Int in 94 | dataSource.values.array[section].count 95 | }, 96 | cellForRowAtIndexPath: { (tableView, indexPath) -> UITableViewCell in 97 | var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell 98 | 99 | let current = dataSource.values.array[indexPath.section][indexPath.row] 100 | cell.textLabel?.text = current 101 | 102 | return cell 103 | }, 104 | didSelectRowAtIndexPath: { (tableView, indexPath) -> () in 105 | tableView.deselectRowAtIndexPath(indexPath, animated: true) 106 | 107 | let selected = dataSource.values.array[indexPath.section][indexPath.row] 108 | println("\(selected) selected") 109 | } 110 | ) 111 | 112 | // Add table to view 113 | self.view.addSubview(table) 114 | } 115 | } 116 | 117 | -------------------------------------------------------------------------------- /BlockTableView-SwiftTests/BlockTableView_SwiftTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // BlockTableView_SwiftTests.swift 3 | // BlockTableView-SwiftTests 4 | // 5 | // Created by Cem Olcay on 12/11/14. 6 | // Copyright (c) 2014 Cem Olcay. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class BlockTableView_SwiftTests: 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 | -------------------------------------------------------------------------------- /BlockTableView-SwiftTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.questa.$(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 | -------------------------------------------------------------------------------- /BlockTableView.podspec: -------------------------------------------------------------------------------- 1 | # 2 | # Be sure to run `pod spec lint BlockTableView.podspec' to ensure this is a 3 | # valid spec and to remove all comments including this before submitting the spec. 4 | # 5 | # To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html 6 | # To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ 7 | # 8 | 9 | Pod::Spec.new do |s| 10 | 11 | # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 12 | # 13 | # These will help people to find your library, and whilst it 14 | # can feel like a chore to fill in it's definitely to your advantage. The 15 | # summary should be tweet-length, and the description more in depth. 16 | # 17 | 18 | s.name = "BlockTableView" 19 | s.version = "0.1" 20 | s.summary = "single line UITableView creation in Swift with power of the closures" 21 | 22 | s.description = <<-DESC 23 | BlockTableView-Swift 24 | ==================== 25 | 26 | single line UITableView creation in Swift with power of the closures 27 | 28 | Usage 29 | ----- 30 | 31 | Copy & paste `BlockTableView.swift` into your project.
32 | 33 | let table = BlockTableView (frame: self.view.frame, 34 | numberOfRowsInSection: { (section) -> Int in 35 | return dataSource.count 36 | }, 37 | cellForRowAtIndexPath: { (tableView, indexPath) -> UITableViewCell in 38 | var cell = UITableViewCell (style: .Default, reuseIdentifier: "Identifer") 39 | 40 | let current = dataSource[indexPath.row] 41 | cell.textLabel.text = current 42 | 43 | return cell 44 | }, 45 | didSelectRowAtIndexPath: { (tableView, indexPath) -> () in 46 | let selected = dataSource[indexPath.row] 47 | println("\(selected) selected") 48 | 49 | tableView.deselectRowAtIndexPath(indexPath, animated: true) 50 | } 51 | ) 52 | 53 | 54 | Initilizers 55 | -------------- 56 | 57 | convenience init(frame: CGRect, 58 | numberOfRowsInSection : (section: Int) -> Int, 59 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 60 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) 61 | 62 | convenience init(frame: CGRect, 63 | numberOfSections : Int, 64 | titleForHeaderInSection : (section: Int) -> String, 65 | numberOfRowsInSection : (section: Int) -> Int, 66 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 67 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) 68 | 69 | convenience init(frame: CGRect, 70 | registeredCells : [String: AnyClass], 71 | numberOfRowsInSection : (section: Int) -> Int, 72 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 73 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) 74 | 75 | init(frame: CGRect, 76 | registeredCells : [String: AnyClass]?, 77 | numberOfSections : Int?, 78 | titleForHeaderInSection : ((section: Int) -> String)?, 79 | numberOfRowsInSection : (section: Int) -> Int, 80 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 81 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) 82 | 83 | 84 | * You can easily add more initilizers with more `UITableViewDelegate`/`UITableViewDataSource` methods 85 | 86 | 87 | Search Bar 88 | ---------- 89 | 90 | Search bar implementation never been easier 91 | 92 | func addSearchBar (searchResultTableView tableView: BlockTableView, didSearch: (String)->()) 93 | 94 | Just create another `BlockTableView` for displaying results and implement the filtering or searching function in didSearch, like 95 | 96 | var filtered: [String]! // search result dataSource 97 | 98 | table.addSearchBar(searchResultTableView: 99 | BlockTableView (frame: self.view.frame, 100 | numberOfRowsInSection: { (section) -> Int in 101 | return filtered.count 102 | }, 103 | cellForRowAtIndexPath: { (tableView, indexPath) -> UITableViewCell in 104 | var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell 105 | cell.textLabel?.text = filtered[indexPath.row] 106 | return cell 107 | }, 108 | didSelectRowAtIndexPath: { (tableView, indexPath) -> () in 109 | return 110 | } 111 | ), didSearch: { searchText in 112 | filtered = filter (dataSource) { $0.rangeOfString(searchText) != nil } 113 | } 114 | ) 115 | 116 | DESC 117 | 118 | s.homepage = "https://github.com/cemolcay/BlockTableView-Swift" 119 | # s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" 120 | 121 | 122 | # ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 123 | # 124 | # Licensing your code is important. See http://choosealicense.com for more info. 125 | # CocoaPods will detect a license file if there is a named LICENSE* 126 | # Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. 127 | # 128 | 129 | s.license = "MIT" 130 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" } 131 | 132 | 133 | # ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 134 | # 135 | # Specify the authors of the library, with email addresses. Email addresses 136 | # of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also 137 | # accepts just a name if you'd rather not provide an email address. 138 | # 139 | # Specify a social_media_url where others can refer to, for example a twitter 140 | # profile URL. 141 | # 142 | 143 | s.author = { "Cem Olcay" => "ccemolcay@gmail.com" } 144 | # Or just: s.author = "Cem Olcay" 145 | # s.authors = { "Cem Olcay" => "ccemolcay@gmail.com" } 146 | # s.social_media_url = "http://twitter.com/Cem Olcay" 147 | 148 | # ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 149 | # 150 | # If this Pod runs only on iOS or OS X, then specify the platform and 151 | # the deployment target. You can optionally include the target after the platform. 152 | # 153 | 154 | # s.platform = :ios 155 | s.platform = :ios, "8.0" 156 | 157 | # When using multiple platforms 158 | # s.ios.deployment_target = "5.0" 159 | # s.osx.deployment_target = "10.7" 160 | 161 | 162 | # ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 163 | # 164 | # Specify the location from where the source should be retrieved. 165 | # Supports git, hg, bzr, svn and HTTP. 166 | # 167 | 168 | s.source = { :git => "https://github.com/cemolcay/BlockTableView-Swift.git", :tag => "v0.1" } 169 | 170 | 171 | # ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 172 | # 173 | # CocoaPods is smart about how it includes source code. For source files 174 | # giving a folder will include any swift, h, m, mm, c & cpp files. 175 | # For header files it will include any header in the folder. 176 | # Not including the public_header_files will make all headers public. 177 | # 178 | 179 | s.source_files = "BlockTableView-Swift/BlockTableView.swift" 180 | 181 | # s.public_header_files = "Classes/**/*.h" 182 | 183 | 184 | # ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 185 | # 186 | # A list of resources included with the Pod. These are copied into the 187 | # target bundle with a build phase script. Anything else will be cleaned. 188 | # You can preserve files from being cleaned, please don't preserve 189 | # non-essential files like tests, examples and documentation. 190 | # 191 | 192 | # s.resource = "icon.png" 193 | # s.resources = "Resources/*.png" 194 | 195 | # s.preserve_paths = "FilesToSave", "MoreFilesToSave" 196 | 197 | 198 | # ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 199 | # 200 | # Link your library with frameworks, or libraries. Libraries do not include 201 | # the lib prefix of their name. 202 | # 203 | 204 | # s.framework = "SomeFramework" 205 | # s.frameworks = "SomeFramework", "AnotherFramework" 206 | 207 | # s.library = "iconv" 208 | # s.libraries = "iconv", "xml2" 209 | 210 | 211 | # ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # 212 | # 213 | # If your library depends on compiler flags you can set them in the xcconfig hash 214 | # where they will only apply to your library. If you depend on other Podspecs 215 | # you can include multiple dependencies to ensure it works. 216 | 217 | s.requires_arc = true 218 | 219 | # s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } 220 | # s.dependency "JSONKit", "~> 1.4" 221 | 222 | end 223 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014, Cem Olcay 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | BlockTableView-Swift 2 | ==================== 3 | 4 | single line UITableView creation in Swift with power of the closures 5 | 6 | Installation 7 | ------------ 8 | 9 | #### Manual 10 | 11 | Copy & paste `BlockTableView.swift` into your project.
12 | 13 | #### CocoaPods 14 | 15 | pod "BlockTableView", "~> 0.1" 16 | 17 | Usage 18 | ----- 19 | 20 | let table = BlockTableView (frame: self.view.frame, 21 | numberOfRowsInSection: { (section) -> Int in 22 | return dataSource.count 23 | }, 24 | cellForRowAtIndexPath: { (tableView, indexPath) -> UITableViewCell in 25 | var cell = UITableViewCell (style: .Default, reuseIdentifier: "Identifer") 26 | 27 | let current = dataSource[indexPath.row] 28 | cell.textLabel.text = current 29 | 30 | return cell 31 | }, 32 | didSelectRowAtIndexPath: { (tableView, indexPath) -> () in 33 | let selected = dataSource[indexPath.row] 34 | println("\(selected) selected") 35 | 36 | tableView.deselectRowAtIndexPath(indexPath, animated: true) 37 | } 38 | ) 39 | 40 | 41 | Initilizers 42 | -------------- 43 | 44 | convenience init(frame: CGRect, 45 | numberOfRowsInSection : (section: Int) -> Int, 46 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 47 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) 48 | 49 | convenience init(frame: CGRect, 50 | numberOfSections : Int, 51 | titleForHeaderInSection : (section: Int) -> String, 52 | numberOfRowsInSection : (section: Int) -> Int, 53 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 54 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) 55 | 56 | convenience init(frame: CGRect, 57 | registeredCells : [String: AnyClass], 58 | numberOfRowsInSection : (section: Int) -> Int, 59 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 60 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) 61 | 62 | init(frame: CGRect, 63 | registeredCells : [String: AnyClass]?, 64 | numberOfSections : Int?, 65 | titleForHeaderInSection : ((section: Int) -> String)?, 66 | numberOfRowsInSection : (section: Int) -> Int, 67 | cellForRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> UITableViewCell, 68 | didSelectRowAtIndexPath : (tableView: UITableView, indexPath: NSIndexPath) -> ()) 69 | 70 | 71 | * You can easily add more initilizers with more `UITableViewDelegate`/`UITableViewDataSource` methods 72 | 73 | 74 | Search Bar 75 | ---------- 76 | 77 | Search bar implementation never been easier 78 | 79 | func addSearchBar (searchResultTableView tableView: BlockTableView, didSearch: (String)->()) 80 | 81 | Just create another `BlockTableView` for displaying results and implement the filtering or searching function in didSearch, like 82 | 83 | var filtered: [String]! // search result dataSource 84 | 85 | table.addSearchBar(searchResultTableView: 86 | BlockTableView (frame: self.view.frame, 87 | numberOfRowsInSection: { (section) -> Int in 88 | return filtered.count 89 | }, 90 | cellForRowAtIndexPath: { (tableView, indexPath) -> UITableViewCell in 91 | var cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell 92 | cell.textLabel?.text = filtered[indexPath.row] 93 | return cell 94 | }, 95 | didSelectRowAtIndexPath: { (tableView, indexPath) -> () in 96 | return 97 | } 98 | ), didSearch: { searchText in 99 | filtered = filter (dataSource) { $0.rangeOfString(searchText) != nil } 100 | } 101 | ) 102 | 103 | --------------------------------------------------------------------------------