├── .gitignore ├── README.md ├── SushiBarControl.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── SushiBarControl ├── AppDelegate.swift ├── Base.lproj │ ├── LaunchScreen.xib │ └── Main.storyboard ├── Images.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Info.plist ├── SushiBarView │ ├── SushiBarScrollView.swift │ └── SushiBarView.swift ├── ViewController.swift ├── photo1.png ├── photo2.png ├── photo3.png ├── photo4.png └── photo5.png └── SushiBarControlTests ├── Info.plist └── SushiBarControlTests.swift /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ios-sushi-bar-view 2 | Button with scrollable modifiers, based on the Snapchat Faces interface. Enables an interaction where users can scroll through modes, and the indicator for the selected mode doubles as an action button. 3 | 4 | Since every UI component needs a food-based name (e.g. hamburger menu), now presenting... 5 | 6 | ![Sushi Bar](http://www.oyatsubreak.com/wp-content/uploads/2012/03/dannychoodotcom_conveyorbeltsushi.jpg) 7 | 8 | ## The Sushi Bar View 9 | 10 | 11 | 12 | Thanks to the Ray Wenderlich [UIScrollView tutorial](http://www.raywenderlich.com/76436/use-uiscrollview-scroll-zoom-content-swift) and also Snapchat 13 | -------------------------------------------------------------------------------- /SushiBarControl.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F44847091BABA81900906ED6 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F44847081BABA81900906ED6 /* AppDelegate.swift */; }; 11 | F448470B1BABA81900906ED6 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F448470A1BABA81900906ED6 /* ViewController.swift */; }; 12 | F448470E1BABA81900906ED6 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F448470C1BABA81900906ED6 /* Main.storyboard */; }; 13 | F44847101BABA81900906ED6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F448470F1BABA81900906ED6 /* Images.xcassets */; }; 14 | F44847131BABA81900906ED6 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = F44847111BABA81900906ED6 /* LaunchScreen.xib */; }; 15 | F448471F1BABA81A00906ED6 /* SushiBarControlTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F448471E1BABA81A00906ED6 /* SushiBarControlTests.swift */; }; 16 | F448472F1BABBA1400906ED6 /* photo1.png in Resources */ = {isa = PBXBuildFile; fileRef = F448472A1BABBA1400906ED6 /* photo1.png */; }; 17 | F44847301BABBA1400906ED6 /* photo2.png in Resources */ = {isa = PBXBuildFile; fileRef = F448472B1BABBA1400906ED6 /* photo2.png */; }; 18 | F44847311BABBA1400906ED6 /* photo3.png in Resources */ = {isa = PBXBuildFile; fileRef = F448472C1BABBA1400906ED6 /* photo3.png */; }; 19 | F44847321BABBA1400906ED6 /* photo4.png in Resources */ = {isa = PBXBuildFile; fileRef = F448472D1BABBA1400906ED6 /* photo4.png */; }; 20 | F44847331BABBA1400906ED6 /* photo5.png in Resources */ = {isa = PBXBuildFile; fileRef = F448472E1BABBA1400906ED6 /* photo5.png */; }; 21 | F4644EC21BB1018600897DD5 /* SushiBarScrollView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4644EC01BB1018600897DD5 /* SushiBarScrollView.swift */; }; 22 | F4644EC31BB1018600897DD5 /* SushiBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4644EC11BB1018600897DD5 /* SushiBarView.swift */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXContainerItemProxy section */ 26 | F44847191BABA81A00906ED6 /* PBXContainerItemProxy */ = { 27 | isa = PBXContainerItemProxy; 28 | containerPortal = F44846FB1BABA81900906ED6 /* Project object */; 29 | proxyType = 1; 30 | remoteGlobalIDString = F44847021BABA81900906ED6; 31 | remoteInfo = SushiBarControl; 32 | }; 33 | /* End PBXContainerItemProxy section */ 34 | 35 | /* Begin PBXFileReference section */ 36 | F44847031BABA81900906ED6 /* SushiBarControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SushiBarControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; 37 | F44847071BABA81900906ED6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 38 | F44847081BABA81900906ED6 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39 | F448470A1BABA81900906ED6 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 40 | F448470D1BABA81900906ED6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 41 | F448470F1BABA81900906ED6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 42 | F44847121BABA81900906ED6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 43 | F44847181BABA81A00906ED6 /* SushiBarControlTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SushiBarControlTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | F448471D1BABA81A00906ED6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 45 | F448471E1BABA81A00906ED6 /* SushiBarControlTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SushiBarControlTests.swift; sourceTree = ""; }; 46 | F448472A1BABBA1400906ED6 /* photo1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo1.png; sourceTree = ""; }; 47 | F448472B1BABBA1400906ED6 /* photo2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo2.png; sourceTree = ""; }; 48 | F448472C1BABBA1400906ED6 /* photo3.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo3.png; sourceTree = ""; }; 49 | F448472D1BABBA1400906ED6 /* photo4.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo4.png; sourceTree = ""; }; 50 | F448472E1BABBA1400906ED6 /* photo5.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = photo5.png; sourceTree = ""; }; 51 | F4644EC01BB1018600897DD5 /* SushiBarScrollView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SushiBarScrollView.swift; path = SushiBarControl/SushiBarView/SushiBarScrollView.swift; sourceTree = ""; }; 52 | F4644EC11BB1018600897DD5 /* SushiBarView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SushiBarView.swift; path = SushiBarControl/SushiBarView/SushiBarView.swift; sourceTree = ""; }; 53 | /* End PBXFileReference section */ 54 | 55 | /* Begin PBXFrameworksBuildPhase section */ 56 | F44847001BABA81900906ED6 /* Frameworks */ = { 57 | isa = PBXFrameworksBuildPhase; 58 | buildActionMask = 2147483647; 59 | files = ( 60 | ); 61 | runOnlyForDeploymentPostprocessing = 0; 62 | }; 63 | F44847151BABA81A00906ED6 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | F44846FA1BABA81900906ED6 = { 74 | isa = PBXGroup; 75 | children = ( 76 | F4644EBF1BB1017C00897DD5 /* SushiBarView */, 77 | F44847051BABA81900906ED6 /* SushiBarControl */, 78 | F448471B1BABA81A00906ED6 /* SushiBarControlTests */, 79 | F44847041BABA81900906ED6 /* Products */, 80 | ); 81 | sourceTree = ""; 82 | }; 83 | F44847041BABA81900906ED6 /* Products */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | F44847031BABA81900906ED6 /* SushiBarControl.app */, 87 | F44847181BABA81A00906ED6 /* SushiBarControlTests.xctest */, 88 | ); 89 | name = Products; 90 | sourceTree = ""; 91 | }; 92 | F44847051BABA81900906ED6 /* SushiBarControl */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | F44847081BABA81900906ED6 /* AppDelegate.swift */, 96 | F448470A1BABA81900906ED6 /* ViewController.swift */, 97 | F448470C1BABA81900906ED6 /* Main.storyboard */, 98 | F448470F1BABA81900906ED6 /* Images.xcassets */, 99 | F44847111BABA81900906ED6 /* LaunchScreen.xib */, 100 | F44847061BABA81900906ED6 /* Supporting Files */, 101 | ); 102 | path = SushiBarControl; 103 | sourceTree = ""; 104 | }; 105 | F44847061BABA81900906ED6 /* Supporting Files */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | F448472A1BABBA1400906ED6 /* photo1.png */, 109 | F448472B1BABBA1400906ED6 /* photo2.png */, 110 | F448472C1BABBA1400906ED6 /* photo3.png */, 111 | F448472D1BABBA1400906ED6 /* photo4.png */, 112 | F448472E1BABBA1400906ED6 /* photo5.png */, 113 | F44847071BABA81900906ED6 /* Info.plist */, 114 | ); 115 | name = "Supporting Files"; 116 | sourceTree = ""; 117 | }; 118 | F448471B1BABA81A00906ED6 /* SushiBarControlTests */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | F448471E1BABA81A00906ED6 /* SushiBarControlTests.swift */, 122 | F448471C1BABA81A00906ED6 /* Supporting Files */, 123 | ); 124 | path = SushiBarControlTests; 125 | sourceTree = ""; 126 | }; 127 | F448471C1BABA81A00906ED6 /* Supporting Files */ = { 128 | isa = PBXGroup; 129 | children = ( 130 | F448471D1BABA81A00906ED6 /* Info.plist */, 131 | ); 132 | name = "Supporting Files"; 133 | sourceTree = ""; 134 | }; 135 | F4644EBF1BB1017C00897DD5 /* SushiBarView */ = { 136 | isa = PBXGroup; 137 | children = ( 138 | F4644EC01BB1018600897DD5 /* SushiBarScrollView.swift */, 139 | F4644EC11BB1018600897DD5 /* SushiBarView.swift */, 140 | ); 141 | name = SushiBarView; 142 | sourceTree = ""; 143 | }; 144 | /* End PBXGroup section */ 145 | 146 | /* Begin PBXNativeTarget section */ 147 | F44847021BABA81900906ED6 /* SushiBarControl */ = { 148 | isa = PBXNativeTarget; 149 | buildConfigurationList = F44847221BABA81A00906ED6 /* Build configuration list for PBXNativeTarget "SushiBarControl" */; 150 | buildPhases = ( 151 | F44846FF1BABA81900906ED6 /* Sources */, 152 | F44847001BABA81900906ED6 /* Frameworks */, 153 | F44847011BABA81900906ED6 /* Resources */, 154 | ); 155 | buildRules = ( 156 | ); 157 | dependencies = ( 158 | ); 159 | name = SushiBarControl; 160 | productName = SushiBarControl; 161 | productReference = F44847031BABA81900906ED6 /* SushiBarControl.app */; 162 | productType = "com.apple.product-type.application"; 163 | }; 164 | F44847171BABA81A00906ED6 /* SushiBarControlTests */ = { 165 | isa = PBXNativeTarget; 166 | buildConfigurationList = F44847251BABA81A00906ED6 /* Build configuration list for PBXNativeTarget "SushiBarControlTests" */; 167 | buildPhases = ( 168 | F44847141BABA81A00906ED6 /* Sources */, 169 | F44847151BABA81A00906ED6 /* Frameworks */, 170 | F44847161BABA81A00906ED6 /* Resources */, 171 | ); 172 | buildRules = ( 173 | ); 174 | dependencies = ( 175 | F448471A1BABA81A00906ED6 /* PBXTargetDependency */, 176 | ); 177 | name = SushiBarControlTests; 178 | productName = SushiBarControlTests; 179 | productReference = F44847181BABA81A00906ED6 /* SushiBarControlTests.xctest */; 180 | productType = "com.apple.product-type.bundle.unit-test"; 181 | }; 182 | /* End PBXNativeTarget section */ 183 | 184 | /* Begin PBXProject section */ 185 | F44846FB1BABA81900906ED6 /* Project object */ = { 186 | isa = PBXProject; 187 | attributes = { 188 | LastSwiftUpdateCheck = 0700; 189 | LastUpgradeCheck = 0630; 190 | ORGANIZATIONNAME = "Jonathan Zong"; 191 | TargetAttributes = { 192 | F44847021BABA81900906ED6 = { 193 | CreatedOnToolsVersion = 6.3.2; 194 | }; 195 | F44847171BABA81A00906ED6 = { 196 | CreatedOnToolsVersion = 6.3.2; 197 | TestTargetID = F44847021BABA81900906ED6; 198 | }; 199 | }; 200 | }; 201 | buildConfigurationList = F44846FE1BABA81900906ED6 /* Build configuration list for PBXProject "SushiBarControl" */; 202 | compatibilityVersion = "Xcode 3.2"; 203 | developmentRegion = English; 204 | hasScannedForEncodings = 0; 205 | knownRegions = ( 206 | en, 207 | Base, 208 | ); 209 | mainGroup = F44846FA1BABA81900906ED6; 210 | productRefGroup = F44847041BABA81900906ED6 /* Products */; 211 | projectDirPath = ""; 212 | projectRoot = ""; 213 | targets = ( 214 | F44847021BABA81900906ED6 /* SushiBarControl */, 215 | F44847171BABA81A00906ED6 /* SushiBarControlTests */, 216 | ); 217 | }; 218 | /* End PBXProject section */ 219 | 220 | /* Begin PBXResourcesBuildPhase section */ 221 | F44847011BABA81900906ED6 /* Resources */ = { 222 | isa = PBXResourcesBuildPhase; 223 | buildActionMask = 2147483647; 224 | files = ( 225 | F44847321BABBA1400906ED6 /* photo4.png in Resources */, 226 | F44847301BABBA1400906ED6 /* photo2.png in Resources */, 227 | F448472F1BABBA1400906ED6 /* photo1.png in Resources */, 228 | F448470E1BABA81900906ED6 /* Main.storyboard in Resources */, 229 | F44847331BABBA1400906ED6 /* photo5.png in Resources */, 230 | F44847131BABA81900906ED6 /* LaunchScreen.xib in Resources */, 231 | F44847311BABBA1400906ED6 /* photo3.png in Resources */, 232 | F44847101BABA81900906ED6 /* Images.xcassets in Resources */, 233 | ); 234 | runOnlyForDeploymentPostprocessing = 0; 235 | }; 236 | F44847161BABA81A00906ED6 /* Resources */ = { 237 | isa = PBXResourcesBuildPhase; 238 | buildActionMask = 2147483647; 239 | files = ( 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | /* End PBXResourcesBuildPhase section */ 244 | 245 | /* Begin PBXSourcesBuildPhase section */ 246 | F44846FF1BABA81900906ED6 /* Sources */ = { 247 | isa = PBXSourcesBuildPhase; 248 | buildActionMask = 2147483647; 249 | files = ( 250 | F448470B1BABA81900906ED6 /* ViewController.swift in Sources */, 251 | F4644EC31BB1018600897DD5 /* SushiBarView.swift in Sources */, 252 | F4644EC21BB1018600897DD5 /* SushiBarScrollView.swift in Sources */, 253 | F44847091BABA81900906ED6 /* AppDelegate.swift in Sources */, 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | F44847141BABA81A00906ED6 /* Sources */ = { 258 | isa = PBXSourcesBuildPhase; 259 | buildActionMask = 2147483647; 260 | files = ( 261 | F448471F1BABA81A00906ED6 /* SushiBarControlTests.swift in Sources */, 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | }; 265 | /* End PBXSourcesBuildPhase section */ 266 | 267 | /* Begin PBXTargetDependency section */ 268 | F448471A1BABA81A00906ED6 /* PBXTargetDependency */ = { 269 | isa = PBXTargetDependency; 270 | target = F44847021BABA81900906ED6 /* SushiBarControl */; 271 | targetProxy = F44847191BABA81A00906ED6 /* PBXContainerItemProxy */; 272 | }; 273 | /* End PBXTargetDependency section */ 274 | 275 | /* Begin PBXVariantGroup section */ 276 | F448470C1BABA81900906ED6 /* Main.storyboard */ = { 277 | isa = PBXVariantGroup; 278 | children = ( 279 | F448470D1BABA81900906ED6 /* Base */, 280 | ); 281 | name = Main.storyboard; 282 | sourceTree = ""; 283 | }; 284 | F44847111BABA81900906ED6 /* LaunchScreen.xib */ = { 285 | isa = PBXVariantGroup; 286 | children = ( 287 | F44847121BABA81900906ED6 /* Base */, 288 | ); 289 | name = LaunchScreen.xib; 290 | sourceTree = ""; 291 | }; 292 | /* End PBXVariantGroup section */ 293 | 294 | /* Begin XCBuildConfiguration section */ 295 | F44847201BABA81A00906ED6 /* Debug */ = { 296 | isa = XCBuildConfiguration; 297 | buildSettings = { 298 | ALWAYS_SEARCH_USER_PATHS = NO; 299 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 300 | CLANG_CXX_LIBRARY = "libc++"; 301 | CLANG_ENABLE_MODULES = YES; 302 | CLANG_ENABLE_OBJC_ARC = YES; 303 | CLANG_WARN_BOOL_CONVERSION = YES; 304 | CLANG_WARN_CONSTANT_CONVERSION = YES; 305 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 306 | CLANG_WARN_EMPTY_BODY = YES; 307 | CLANG_WARN_ENUM_CONVERSION = YES; 308 | CLANG_WARN_INT_CONVERSION = YES; 309 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 310 | CLANG_WARN_UNREACHABLE_CODE = YES; 311 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 312 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 313 | COPY_PHASE_STRIP = NO; 314 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 315 | ENABLE_STRICT_OBJC_MSGSEND = YES; 316 | GCC_C_LANGUAGE_STANDARD = gnu99; 317 | GCC_DYNAMIC_NO_PIC = NO; 318 | GCC_NO_COMMON_BLOCKS = YES; 319 | GCC_OPTIMIZATION_LEVEL = 0; 320 | GCC_PREPROCESSOR_DEFINITIONS = ( 321 | "DEBUG=1", 322 | "$(inherited)", 323 | ); 324 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 325 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 326 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 327 | GCC_WARN_UNDECLARED_SELECTOR = YES; 328 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 329 | GCC_WARN_UNUSED_FUNCTION = YES; 330 | GCC_WARN_UNUSED_VARIABLE = YES; 331 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 332 | MTL_ENABLE_DEBUG_INFO = YES; 333 | ONLY_ACTIVE_ARCH = YES; 334 | SDKROOT = iphoneos; 335 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 336 | TARGETED_DEVICE_FAMILY = "1,2"; 337 | }; 338 | name = Debug; 339 | }; 340 | F44847211BABA81A00906ED6 /* Release */ = { 341 | isa = XCBuildConfiguration; 342 | buildSettings = { 343 | ALWAYS_SEARCH_USER_PATHS = NO; 344 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 345 | CLANG_CXX_LIBRARY = "libc++"; 346 | CLANG_ENABLE_MODULES = YES; 347 | CLANG_ENABLE_OBJC_ARC = YES; 348 | CLANG_WARN_BOOL_CONVERSION = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INT_CONVERSION = YES; 354 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 355 | CLANG_WARN_UNREACHABLE_CODE = YES; 356 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 357 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 358 | COPY_PHASE_STRIP = NO; 359 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 360 | ENABLE_NS_ASSERTIONS = NO; 361 | ENABLE_STRICT_OBJC_MSGSEND = YES; 362 | GCC_C_LANGUAGE_STANDARD = gnu99; 363 | GCC_NO_COMMON_BLOCKS = YES; 364 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 365 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 366 | GCC_WARN_UNDECLARED_SELECTOR = YES; 367 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 368 | GCC_WARN_UNUSED_FUNCTION = YES; 369 | GCC_WARN_UNUSED_VARIABLE = YES; 370 | IPHONEOS_DEPLOYMENT_TARGET = 8.3; 371 | MTL_ENABLE_DEBUG_INFO = NO; 372 | SDKROOT = iphoneos; 373 | TARGETED_DEVICE_FAMILY = "1,2"; 374 | VALIDATE_PRODUCT = YES; 375 | }; 376 | name = Release; 377 | }; 378 | F44847231BABA81A00906ED6 /* Debug */ = { 379 | isa = XCBuildConfiguration; 380 | buildSettings = { 381 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 382 | INFOPLIST_FILE = SushiBarControl/Info.plist; 383 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 384 | PRODUCT_NAME = "$(TARGET_NAME)"; 385 | }; 386 | name = Debug; 387 | }; 388 | F44847241BABA81A00906ED6 /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | buildSettings = { 391 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 392 | INFOPLIST_FILE = SushiBarControl/Info.plist; 393 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 394 | PRODUCT_NAME = "$(TARGET_NAME)"; 395 | }; 396 | name = Release; 397 | }; 398 | F44847261BABA81A00906ED6 /* Debug */ = { 399 | isa = XCBuildConfiguration; 400 | buildSettings = { 401 | BUNDLE_LOADER = "$(TEST_HOST)"; 402 | FRAMEWORK_SEARCH_PATHS = ( 403 | "$(SDKROOT)/Developer/Library/Frameworks", 404 | "$(inherited)", 405 | ); 406 | GCC_PREPROCESSOR_DEFINITIONS = ( 407 | "DEBUG=1", 408 | "$(inherited)", 409 | ); 410 | INFOPLIST_FILE = SushiBarControlTests/Info.plist; 411 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 412 | PRODUCT_NAME = "$(TARGET_NAME)"; 413 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SushiBarControl.app/SushiBarControl"; 414 | }; 415 | name = Debug; 416 | }; 417 | F44847271BABA81A00906ED6 /* Release */ = { 418 | isa = XCBuildConfiguration; 419 | buildSettings = { 420 | BUNDLE_LOADER = "$(TEST_HOST)"; 421 | FRAMEWORK_SEARCH_PATHS = ( 422 | "$(SDKROOT)/Developer/Library/Frameworks", 423 | "$(inherited)", 424 | ); 425 | INFOPLIST_FILE = SushiBarControlTests/Info.plist; 426 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 427 | PRODUCT_NAME = "$(TARGET_NAME)"; 428 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/SushiBarControl.app/SushiBarControl"; 429 | }; 430 | name = Release; 431 | }; 432 | /* End XCBuildConfiguration section */ 433 | 434 | /* Begin XCConfigurationList section */ 435 | F44846FE1BABA81900906ED6 /* Build configuration list for PBXProject "SushiBarControl" */ = { 436 | isa = XCConfigurationList; 437 | buildConfigurations = ( 438 | F44847201BABA81A00906ED6 /* Debug */, 439 | F44847211BABA81A00906ED6 /* Release */, 440 | ); 441 | defaultConfigurationIsVisible = 0; 442 | defaultConfigurationName = Release; 443 | }; 444 | F44847221BABA81A00906ED6 /* Build configuration list for PBXNativeTarget "SushiBarControl" */ = { 445 | isa = XCConfigurationList; 446 | buildConfigurations = ( 447 | F44847231BABA81A00906ED6 /* Debug */, 448 | F44847241BABA81A00906ED6 /* Release */, 449 | ); 450 | defaultConfigurationIsVisible = 0; 451 | defaultConfigurationName = Release; 452 | }; 453 | F44847251BABA81A00906ED6 /* Build configuration list for PBXNativeTarget "SushiBarControlTests" */ = { 454 | isa = XCConfigurationList; 455 | buildConfigurations = ( 456 | F44847261BABA81A00906ED6 /* Debug */, 457 | F44847271BABA81A00906ED6 /* Release */, 458 | ); 459 | defaultConfigurationIsVisible = 0; 460 | defaultConfigurationName = Release; 461 | }; 462 | /* End XCConfigurationList section */ 463 | }; 464 | rootObject = F44846FB1BABA81900906ED6 /* Project object */; 465 | } 466 | -------------------------------------------------------------------------------- /SushiBarControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SushiBarControl/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SushiBarControl 4 | // 5 | // Created by Jonathan Zong on 9/17/15. 6 | // Copyright (c) 2015 Jonathan Zong. 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 | -------------------------------------------------------------------------------- /SushiBarControl/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 | -------------------------------------------------------------------------------- /SushiBarControl/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 | -------------------------------------------------------------------------------- /SushiBarControl/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 | "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 | } -------------------------------------------------------------------------------- /SushiBarControl/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.jonathanzong.$(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 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /SushiBarControl/SushiBarView/SushiBarScrollView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SushiBarScrollView.swift 3 | // SushiBarControl 4 | // 5 | // Created by Jonathan Zong on 9/17/15. 6 | // Copyright (c) 2015 Jonathan Zong. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SushiBarScrollView: UIScrollView { 12 | 13 | class _DelegateProxy: NSObject, UIScrollViewDelegate { 14 | weak var _userDelegate: UIScrollViewDelegate? 15 | 16 | override func respondsToSelector(aSelector: Selector) -> Bool { 17 | return super.respondsToSelector(aSelector) || (_userDelegate?.respondsToSelector(aSelector) == true) 18 | } 19 | 20 | override func forwardingTargetForSelector(aSelector: Selector) -> AnyObject? { 21 | if _userDelegate?.respondsToSelector(aSelector) == true { 22 | return _userDelegate 23 | } 24 | else { 25 | return super.forwardingTargetForSelector(aSelector) 26 | } 27 | } 28 | 29 | func scrollViewDidScroll(scrollView: UIScrollView) { 30 | if let sushiBar = scrollView as? SushiBarScrollView { 31 | sushiBar.didScroll() 32 | } 33 | _userDelegate?.scrollViewDidScroll?(scrollView) 34 | } 35 | } 36 | 37 | required init(coder aDecoder: NSCoder) { 38 | fatalError("init(coder:) has not been implemented") 39 | } 40 | 41 | private var _delegateProxy = _DelegateProxy() 42 | 43 | override init(frame: CGRect) { 44 | super.init(frame: frame) 45 | super.delegate = _delegateProxy 46 | 47 | self.pagingEnabled = true 48 | self.clipsToBounds = false 49 | self.showsHorizontalScrollIndicator = false 50 | } 51 | 52 | override var delegate:UIScrollViewDelegate? { 53 | get { 54 | return _delegateProxy._userDelegate 55 | } 56 | set { 57 | self._delegateProxy._userDelegate = newValue 58 | } 59 | } 60 | 61 | // 62 | 63 | var pageImages: [UIImage] = [] 64 | var pageViews: [UIImageView?] = [] 65 | 66 | var button: UIButton? 67 | 68 | func loadPage(page: Int) { 69 | 70 | if page < 0 || page >= pageImages.count { 71 | // If it's outside the range of what you have to display, then do nothing 72 | return 73 | } 74 | 75 | // Load an individual page, first checking if you've already loaded it 76 | if let pageView = pageViews[page] { 77 | // Do nothing. The view is already loaded. 78 | } else { 79 | var frame = self.bounds 80 | frame.size.height = min(frame.size.width, frame.size.height) 81 | frame.size.width = frame.size.height 82 | frame.origin.x = frame.size.width * CGFloat(page) 83 | frame.origin.y = 0.0 84 | 85 | frame = CGRectInset(frame, 10.0, 10.0) 86 | 87 | let newPageView = UIImageView(image: pageImages[page]) 88 | newPageView.contentMode = .ScaleAspectFill 89 | newPageView.frame = frame 90 | 91 | newPageView.layer.borderWidth = 3.0 92 | newPageView.layer.masksToBounds = false 93 | newPageView.layer.borderColor = UIColor.whiteColor().CGColor 94 | newPageView.layer.cornerRadius = newPageView.frame.size.height / 2 95 | newPageView.clipsToBounds = true 96 | 97 | self.addSubview(newPageView) 98 | pageViews[page] = newPageView 99 | } 100 | } 101 | 102 | func purgePage(page: Int) { 103 | 104 | 105 | if page < 0 || page >= pageImages.count { 106 | // If it's outside the range of what you have to display, then do nothing 107 | return 108 | } 109 | 110 | // Remove a page from the scroll view and reset the container array 111 | if let pageView = pageViews[page] { 112 | pageView.removeFromSuperview() 113 | pageViews[page] = nil 114 | } 115 | 116 | } 117 | 118 | func loadVisiblePages() { 119 | 120 | // First, determine which page is currently visible 121 | let pageWidth = self.frame.size.width 122 | let page = Int(floor((self.contentOffset.x * 2.0 + pageWidth) / (pageWidth * 2.0))) 123 | 124 | // Work out which pages you want to load 125 | let firstPage = page - 1 126 | let lastPage = page + 1 127 | 128 | 129 | // Purge anything before the first page 130 | for var index = 0; index < firstPage; ++index { 131 | purgePage(index) 132 | } 133 | 134 | // Load pages in our range 135 | for var index = firstPage; index <= lastPage; ++index { 136 | loadPage(index) 137 | } 138 | 139 | // Purge anything after the last page 140 | for var index = lastPage+1; index < pageImages.count; ++index { 141 | purgePage(index) 142 | } 143 | } 144 | 145 | func didScroll() { 146 | loadVisiblePages() 147 | button?.frame.origin = self.contentOffset 148 | } 149 | } -------------------------------------------------------------------------------- /SushiBarControl/SushiBarView/SushiBarView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SushiBarView.swift 3 | // SushiBarControl 4 | // 5 | // Created by Jonathan Zong on 9/18/15. 6 | // Copyright (c) 2015 Jonathan Zong. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SushiBarView: UIView { 12 | var scrollView: SushiBarScrollView? 13 | var button: UIButton? 14 | 15 | override init(frame: CGRect) { 16 | super.init(frame: frame) 17 | let minDim = min(frame.height, frame.width) 18 | let squareFrame = CGRect(x: frame.width / 2 - minDim / 2, y: 0, width: minDim, height: minDim) 19 | scrollView = SushiBarScrollView(frame: squareFrame) 20 | self.addSubview(scrollView!) 21 | self.clipsToBounds = true 22 | 23 | let newButton = UIButton(frame: squareFrame) 24 | newButton.frame.origin.x = 0 25 | newButton.layer.cornerRadius = newButton.bounds.size.height / 2.0 26 | newButton.layer.borderWidth = 5.0 27 | newButton.layer.masksToBounds = false 28 | newButton.layer.borderColor = UIColor.whiteColor().CGColor 29 | 30 | button = newButton 31 | scrollView!.button = button! 32 | scrollView!.addSubview(button!) 33 | } 34 | 35 | required init(coder aDecoder: NSCoder) { 36 | fatalError("init(coder:) has not been implemented") 37 | } 38 | 39 | override func hitTest(point: CGPoint, withEvent event: UIEvent!) -> UIView? { 40 | let view = super.hitTest(point, withEvent: event) 41 | if let theView = view { 42 | if theView == self { 43 | return scrollView 44 | } 45 | } 46 | 47 | return view 48 | } 49 | 50 | func setPageImages(pageImages: [UIImage]) { 51 | scrollView?.pageImages = pageImages 52 | 53 | let pageCount = pageImages.count 54 | 55 | // Set up the array to hold the views for each page 56 | while scrollView?.pageViews.count < pageCount { 57 | scrollView?.pageViews.append(nil) 58 | } 59 | 60 | // Set up the content size of the scroll view 61 | if let pagesScrollViewSize = scrollView?.frame.size { 62 | scrollView?.contentSize = CGSizeMake(pagesScrollViewSize.width * CGFloat(pageImages.count), pagesScrollViewSize.height) 63 | } 64 | 65 | // Load the initial set of pages that are on screen 66 | scrollView?.loadVisiblePages() 67 | } 68 | 69 | func setSelectedIndex(index: Int) { 70 | self.scrollView?.contentOffset = CGPoint(x: scrollView!.frame.width * CGFloat(index), y: scrollView!.contentOffset.y) 71 | } 72 | } -------------------------------------------------------------------------------- /SushiBarControl/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SushiBarControl 4 | // 5 | // Created by Jonathan Zong on 9/17/15. 6 | // Copyright (c) 2015 Jonathan Zong. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | override func viewDidLoad() { 14 | super.viewDidLoad() 15 | // Do any additional setup after loading the view, typically from a nib. 16 | let view = SushiBarView(frame: CGRect(x: 0, y: self.view.frame.height - 150, width: self.view.frame.width, height: 100)) 17 | view.setPageImages([UIImage(named:"photo1.png")!, 18 | UIImage(named:"photo2.png")!, 19 | UIImage(named:"photo3.png")!, 20 | UIImage(named:"photo4.png")!, 21 | UIImage(named:"photo5.png")!]) 22 | 23 | view.setSelectedIndex(2) 24 | 25 | view.button?.addTarget(self, action: "buttonPressed:", forControlEvents: .TouchUpInside) 26 | 27 | 28 | self.view.backgroundColor = UIColor.darkGrayColor() 29 | self.view.addSubview(view) 30 | } 31 | 32 | override func didReceiveMemoryWarning() { 33 | super.didReceiveMemoryWarning() 34 | // Dispose of any resources that can be recreated. 35 | } 36 | 37 | func buttonPressed(sender:UIButton!) { 38 | println("Button pressed") 39 | } 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /SushiBarControl/photo1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanzong/ios-sushi-bar-view/e2ba76c2d8b4317bdf19dce1c277729eb21e31ba/SushiBarControl/photo1.png -------------------------------------------------------------------------------- /SushiBarControl/photo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanzong/ios-sushi-bar-view/e2ba76c2d8b4317bdf19dce1c277729eb21e31ba/SushiBarControl/photo2.png -------------------------------------------------------------------------------- /SushiBarControl/photo3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanzong/ios-sushi-bar-view/e2ba76c2d8b4317bdf19dce1c277729eb21e31ba/SushiBarControl/photo3.png -------------------------------------------------------------------------------- /SushiBarControl/photo4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanzong/ios-sushi-bar-view/e2ba76c2d8b4317bdf19dce1c277729eb21e31ba/SushiBarControl/photo4.png -------------------------------------------------------------------------------- /SushiBarControl/photo5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonathanzong/ios-sushi-bar-view/e2ba76c2d8b4317bdf19dce1c277729eb21e31ba/SushiBarControl/photo5.png -------------------------------------------------------------------------------- /SushiBarControlTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.jonathanzong.$(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 | -------------------------------------------------------------------------------- /SushiBarControlTests/SushiBarControlTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SushiBarControlTests.swift 3 | // SushiBarControlTests 4 | // 5 | // Created by Jonathan Zong on 9/17/15. 6 | // Copyright (c) 2015 Jonathan Zong. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import XCTest 11 | 12 | class SushiBarControlTests: 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 | --------------------------------------------------------------------------------