├── DynamicNavigationBar.podspec ├── Example ├── Example.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── Example │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── DynamicNavigationBar │ ├── DynamicNavigationBar.swift │ └── DynamicViewController.swift │ ├── Example.entitlements │ ├── Info.plist │ └── ViewController.swift ├── LICENSE ├── README.md └── demo.gif /DynamicNavigationBar.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'DynamicNavigationBar' 3 | s.version = '1.3' 4 | s.summary = 'A navigation bar that can be expanded by drag' 5 | 6 | s.description = <<-DESC 7 | A navigation bar that can be expanded by drag. 8 | DESC 9 | 10 | s.homepage = 'https://github.com/muhammadbassio/DynamicNavigationBar' 11 | s.license = { :type => 'MIT', :file => 'LICENSE' } 12 | s.author = { 'Muhammad Bassio' => 'muhammadbassio@gmail.com' } 13 | s.source = { :git => 'https://github.com/muhammadbassio/DynamicNavigationBar.git', :tag => s.version.to_s } 14 | 15 | s.ios.deployment_target = '11.0' 16 | s.source_files = 'Example/Example/DynamicNavigationBar/*.swift' 17 | s.swift_version = '4.2' 18 | 19 | end -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 08B3AA7B2176121C0020373C /* StoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08B3AA7A2176121C0020373C /* StoreKit.framework */; }; 11 | 08E29DD0216CBC54005821A7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E29DCF216CBC54005821A7 /* AppDelegate.swift */; }; 12 | 08E29DD2216CBC54005821A7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E29DD1216CBC54005821A7 /* ViewController.swift */; }; 13 | 08E29DD5216CBC54005821A7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 08E29DD3216CBC54005821A7 /* Main.storyboard */; }; 14 | 08E29DD7216CBC56005821A7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 08E29DD6216CBC56005821A7 /* Assets.xcassets */; }; 15 | 08E29DDA216CBC56005821A7 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 08E29DD8216CBC56005821A7 /* LaunchScreen.storyboard */; }; 16 | 08E29DE3216CBC95005821A7 /* DynamicNavigationBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E29DE2216CBC95005821A7 /* DynamicNavigationBar.swift */; }; 17 | 08E29DE5216CBF38005821A7 /* DynamicViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08E29DE4216CBF38005821A7 /* DynamicViewController.swift */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | 08B3AA78217612120020373C /* Example.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Example.entitlements; sourceTree = ""; }; 22 | 08B3AA7A2176121C0020373C /* StoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = StoreKit.framework; path = System/Library/Frameworks/StoreKit.framework; sourceTree = SDKROOT; }; 23 | 08E29DCC216CBC54005821A7 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 24 | 08E29DCF216CBC54005821A7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 25 | 08E29DD1216CBC54005821A7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 26 | 08E29DD4216CBC54005821A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | 08E29DD6216CBC56005821A7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | 08E29DD9216CBC56005821A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | 08E29DDB216CBC56005821A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | 08E29DE2216CBC95005821A7 /* DynamicNavigationBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicNavigationBar.swift; sourceTree = ""; }; 31 | 08E29DE4216CBF38005821A7 /* DynamicViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DynamicViewController.swift; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | 08E29DC9216CBC54005821A7 /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | 08B3AA7B2176121C0020373C /* StoreKit.framework in Frameworks */, 40 | ); 41 | runOnlyForDeploymentPostprocessing = 0; 42 | }; 43 | /* End PBXFrameworksBuildPhase section */ 44 | 45 | /* Begin PBXGroup section */ 46 | 08B3AA792176121C0020373C /* Frameworks */ = { 47 | isa = PBXGroup; 48 | children = ( 49 | 08B3AA7A2176121C0020373C /* StoreKit.framework */, 50 | ); 51 | name = Frameworks; 52 | sourceTree = ""; 53 | }; 54 | 08E29DC3216CBC54005821A7 = { 55 | isa = PBXGroup; 56 | children = ( 57 | 08E29DCE216CBC54005821A7 /* Example */, 58 | 08E29DCD216CBC54005821A7 /* Products */, 59 | 08B3AA792176121C0020373C /* Frameworks */, 60 | ); 61 | sourceTree = ""; 62 | }; 63 | 08E29DCD216CBC54005821A7 /* Products */ = { 64 | isa = PBXGroup; 65 | children = ( 66 | 08E29DCC216CBC54005821A7 /* Example.app */, 67 | ); 68 | name = Products; 69 | sourceTree = ""; 70 | }; 71 | 08E29DCE216CBC54005821A7 /* Example */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 08B3AA78217612120020373C /* Example.entitlements */, 75 | 08E29DE1216CBC79005821A7 /* DynamicNavigationBar */, 76 | 08E29DCF216CBC54005821A7 /* AppDelegate.swift */, 77 | 08E29DD1216CBC54005821A7 /* ViewController.swift */, 78 | 08E29DD3216CBC54005821A7 /* Main.storyboard */, 79 | 08E29DD6216CBC56005821A7 /* Assets.xcassets */, 80 | 08E29DD8216CBC56005821A7 /* LaunchScreen.storyboard */, 81 | 08E29DDB216CBC56005821A7 /* Info.plist */, 82 | ); 83 | path = Example; 84 | sourceTree = ""; 85 | }; 86 | 08E29DE1216CBC79005821A7 /* DynamicNavigationBar */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | 08E29DE2216CBC95005821A7 /* DynamicNavigationBar.swift */, 90 | 08E29DE4216CBF38005821A7 /* DynamicViewController.swift */, 91 | ); 92 | path = DynamicNavigationBar; 93 | sourceTree = ""; 94 | }; 95 | /* End PBXGroup section */ 96 | 97 | /* Begin PBXNativeTarget section */ 98 | 08E29DCB216CBC54005821A7 /* Example */ = { 99 | isa = PBXNativeTarget; 100 | buildConfigurationList = 08E29DDE216CBC56005821A7 /* Build configuration list for PBXNativeTarget "Example" */; 101 | buildPhases = ( 102 | 08E29DC8216CBC54005821A7 /* Sources */, 103 | 08E29DC9216CBC54005821A7 /* Frameworks */, 104 | 08E29DCA216CBC54005821A7 /* Resources */, 105 | ); 106 | buildRules = ( 107 | ); 108 | dependencies = ( 109 | ); 110 | name = Example; 111 | productName = Example; 112 | productReference = 08E29DCC216CBC54005821A7 /* Example.app */; 113 | productType = "com.apple.product-type.application"; 114 | }; 115 | /* End PBXNativeTarget section */ 116 | 117 | /* Begin PBXProject section */ 118 | 08E29DC4216CBC54005821A7 /* Project object */ = { 119 | isa = PBXProject; 120 | attributes = { 121 | LastSwiftUpdateCheck = 1000; 122 | LastUpgradeCheck = 1000; 123 | ORGANIZATIONNAME = "Muhammad Bassio"; 124 | TargetAttributes = { 125 | 08E29DCB216CBC54005821A7 = { 126 | CreatedOnToolsVersion = 10.0; 127 | SystemCapabilities = { 128 | com.apple.InAppPurchase = { 129 | enabled = 1; 130 | }; 131 | com.apple.Push = { 132 | enabled = 1; 133 | }; 134 | }; 135 | }; 136 | }; 137 | }; 138 | buildConfigurationList = 08E29DC7216CBC54005821A7 /* Build configuration list for PBXProject "Example" */; 139 | compatibilityVersion = "Xcode 9.3"; 140 | developmentRegion = en; 141 | hasScannedForEncodings = 0; 142 | knownRegions = ( 143 | en, 144 | Base, 145 | ); 146 | mainGroup = 08E29DC3216CBC54005821A7; 147 | productRefGroup = 08E29DCD216CBC54005821A7 /* Products */; 148 | projectDirPath = ""; 149 | projectRoot = ""; 150 | targets = ( 151 | 08E29DCB216CBC54005821A7 /* Example */, 152 | ); 153 | }; 154 | /* End PBXProject section */ 155 | 156 | /* Begin PBXResourcesBuildPhase section */ 157 | 08E29DCA216CBC54005821A7 /* Resources */ = { 158 | isa = PBXResourcesBuildPhase; 159 | buildActionMask = 2147483647; 160 | files = ( 161 | 08E29DDA216CBC56005821A7 /* LaunchScreen.storyboard in Resources */, 162 | 08E29DD7216CBC56005821A7 /* Assets.xcassets in Resources */, 163 | 08E29DD5216CBC54005821A7 /* Main.storyboard in Resources */, 164 | ); 165 | runOnlyForDeploymentPostprocessing = 0; 166 | }; 167 | /* End PBXResourcesBuildPhase section */ 168 | 169 | /* Begin PBXSourcesBuildPhase section */ 170 | 08E29DC8216CBC54005821A7 /* Sources */ = { 171 | isa = PBXSourcesBuildPhase; 172 | buildActionMask = 2147483647; 173 | files = ( 174 | 08E29DD2216CBC54005821A7 /* ViewController.swift in Sources */, 175 | 08E29DD0216CBC54005821A7 /* AppDelegate.swift in Sources */, 176 | 08E29DE5216CBF38005821A7 /* DynamicViewController.swift in Sources */, 177 | 08E29DE3216CBC95005821A7 /* DynamicNavigationBar.swift in Sources */, 178 | ); 179 | runOnlyForDeploymentPostprocessing = 0; 180 | }; 181 | /* End PBXSourcesBuildPhase section */ 182 | 183 | /* Begin PBXVariantGroup section */ 184 | 08E29DD3216CBC54005821A7 /* Main.storyboard */ = { 185 | isa = PBXVariantGroup; 186 | children = ( 187 | 08E29DD4216CBC54005821A7 /* Base */, 188 | ); 189 | name = Main.storyboard; 190 | sourceTree = ""; 191 | }; 192 | 08E29DD8216CBC56005821A7 /* LaunchScreen.storyboard */ = { 193 | isa = PBXVariantGroup; 194 | children = ( 195 | 08E29DD9216CBC56005821A7 /* Base */, 196 | ); 197 | name = LaunchScreen.storyboard; 198 | sourceTree = ""; 199 | }; 200 | /* End PBXVariantGroup section */ 201 | 202 | /* Begin XCBuildConfiguration section */ 203 | 08E29DDC216CBC56005821A7 /* Debug */ = { 204 | isa = XCBuildConfiguration; 205 | buildSettings = { 206 | ALWAYS_SEARCH_USER_PATHS = NO; 207 | CLANG_ANALYZER_NONNULL = YES; 208 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 209 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 210 | CLANG_CXX_LIBRARY = "libc++"; 211 | CLANG_ENABLE_MODULES = YES; 212 | CLANG_ENABLE_OBJC_ARC = YES; 213 | CLANG_ENABLE_OBJC_WEAK = YES; 214 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 215 | CLANG_WARN_BOOL_CONVERSION = YES; 216 | CLANG_WARN_COMMA = YES; 217 | CLANG_WARN_CONSTANT_CONVERSION = YES; 218 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 219 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 220 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 221 | CLANG_WARN_EMPTY_BODY = YES; 222 | CLANG_WARN_ENUM_CONVERSION = YES; 223 | CLANG_WARN_INFINITE_RECURSION = YES; 224 | CLANG_WARN_INT_CONVERSION = YES; 225 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 226 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 227 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 228 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 229 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 230 | CLANG_WARN_STRICT_PROTOTYPES = YES; 231 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 232 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 233 | CLANG_WARN_UNREACHABLE_CODE = YES; 234 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 235 | CODE_SIGN_IDENTITY = "iPhone Developer"; 236 | COPY_PHASE_STRIP = NO; 237 | DEBUG_INFORMATION_FORMAT = dwarf; 238 | ENABLE_STRICT_OBJC_MSGSEND = YES; 239 | ENABLE_TESTABILITY = YES; 240 | GCC_C_LANGUAGE_STANDARD = gnu11; 241 | GCC_DYNAMIC_NO_PIC = NO; 242 | GCC_NO_COMMON_BLOCKS = YES; 243 | GCC_OPTIMIZATION_LEVEL = 0; 244 | GCC_PREPROCESSOR_DEFINITIONS = ( 245 | "DEBUG=1", 246 | "$(inherited)", 247 | ); 248 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 249 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 250 | GCC_WARN_UNDECLARED_SELECTOR = YES; 251 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 252 | GCC_WARN_UNUSED_FUNCTION = YES; 253 | GCC_WARN_UNUSED_VARIABLE = YES; 254 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 255 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 256 | MTL_FAST_MATH = YES; 257 | ONLY_ACTIVE_ARCH = YES; 258 | SDKROOT = iphoneos; 259 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 260 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 261 | }; 262 | name = Debug; 263 | }; 264 | 08E29DDD216CBC56005821A7 /* Release */ = { 265 | isa = XCBuildConfiguration; 266 | buildSettings = { 267 | ALWAYS_SEARCH_USER_PATHS = NO; 268 | CLANG_ANALYZER_NONNULL = YES; 269 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_ENABLE_OBJC_WEAK = YES; 275 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 276 | CLANG_WARN_BOOL_CONVERSION = YES; 277 | CLANG_WARN_COMMA = YES; 278 | CLANG_WARN_CONSTANT_CONVERSION = YES; 279 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 280 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 281 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 282 | CLANG_WARN_EMPTY_BODY = YES; 283 | CLANG_WARN_ENUM_CONVERSION = YES; 284 | CLANG_WARN_INFINITE_RECURSION = YES; 285 | CLANG_WARN_INT_CONVERSION = YES; 286 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 287 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 288 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 289 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 290 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 291 | CLANG_WARN_STRICT_PROTOTYPES = YES; 292 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 293 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 294 | CLANG_WARN_UNREACHABLE_CODE = YES; 295 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 296 | CODE_SIGN_IDENTITY = "iPhone Developer"; 297 | COPY_PHASE_STRIP = NO; 298 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 299 | ENABLE_NS_ASSERTIONS = NO; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | GCC_C_LANGUAGE_STANDARD = gnu11; 302 | GCC_NO_COMMON_BLOCKS = YES; 303 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 304 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 305 | GCC_WARN_UNDECLARED_SELECTOR = YES; 306 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 307 | GCC_WARN_UNUSED_FUNCTION = YES; 308 | GCC_WARN_UNUSED_VARIABLE = YES; 309 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 310 | MTL_ENABLE_DEBUG_INFO = NO; 311 | MTL_FAST_MATH = YES; 312 | SDKROOT = iphoneos; 313 | SWIFT_COMPILATION_MODE = wholemodule; 314 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 315 | VALIDATE_PRODUCT = YES; 316 | }; 317 | name = Release; 318 | }; 319 | 08E29DDF216CBC56005821A7 /* Debug */ = { 320 | isa = XCBuildConfiguration; 321 | buildSettings = { 322 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 323 | CODE_SIGN_ENTITLEMENTS = Example/Example.entitlements; 324 | CODE_SIGN_STYLE = Automatic; 325 | DEVELOPMENT_TEAM = ADY83YFFM5; 326 | INFOPLIST_FILE = Example/Info.plist; 327 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 328 | LD_RUNPATH_SEARCH_PATHS = ( 329 | "$(inherited)", 330 | "@executable_path/Frameworks", 331 | ); 332 | PRODUCT_BUNDLE_IDENTIFIER = io.houseofcode.mosson.staging1; 333 | PRODUCT_NAME = "$(TARGET_NAME)"; 334 | SWIFT_VERSION = 4.2; 335 | TARGETED_DEVICE_FAMILY = 1; 336 | }; 337 | name = Debug; 338 | }; 339 | 08E29DE0216CBC56005821A7 /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 343 | CODE_SIGN_ENTITLEMENTS = Example/Example.entitlements; 344 | CODE_SIGN_STYLE = Automatic; 345 | DEVELOPMENT_TEAM = ADY83YFFM5; 346 | INFOPLIST_FILE = Example/Info.plist; 347 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 348 | LD_RUNPATH_SEARCH_PATHS = ( 349 | "$(inherited)", 350 | "@executable_path/Frameworks", 351 | ); 352 | PRODUCT_BUNDLE_IDENTIFIER = io.houseofcode.mosson.staging1; 353 | PRODUCT_NAME = "$(TARGET_NAME)"; 354 | SWIFT_VERSION = 4.2; 355 | TARGETED_DEVICE_FAMILY = 1; 356 | }; 357 | name = Release; 358 | }; 359 | /* End XCBuildConfiguration section */ 360 | 361 | /* Begin XCConfigurationList section */ 362 | 08E29DC7216CBC54005821A7 /* Build configuration list for PBXProject "Example" */ = { 363 | isa = XCConfigurationList; 364 | buildConfigurations = ( 365 | 08E29DDC216CBC56005821A7 /* Debug */, 366 | 08E29DDD216CBC56005821A7 /* Release */, 367 | ); 368 | defaultConfigurationIsVisible = 0; 369 | defaultConfigurationName = Release; 370 | }; 371 | 08E29DDE216CBC56005821A7 /* Build configuration list for PBXNativeTarget "Example" */ = { 372 | isa = XCConfigurationList; 373 | buildConfigurations = ( 374 | 08E29DDF216CBC56005821A7 /* Debug */, 375 | 08E29DE0216CBC56005821A7 /* Release */, 376 | ); 377 | defaultConfigurationIsVisible = 0; 378 | defaultConfigurationName = Release; 379 | }; 380 | /* End XCConfigurationList section */ 381 | }; 382 | rootObject = 08E29DC4216CBC54005821A7 /* Project object */; 383 | } 384 | -------------------------------------------------------------------------------- /Example/Example.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/Example/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Example 3 | // 4 | // Copyright © 2018 Muhammad Bassio. All rights reserved. 5 | // 6 | 7 | import UIKit 8 | 9 | @UIApplicationMain 10 | class AppDelegate: UIResponder, UIApplicationDelegate { 11 | 12 | var window: UIWindow? 13 | 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 | // Override point for customization after application launch. 17 | return true 18 | } 19 | 20 | func applicationWillResignActive(_ application: UIApplication) { 21 | // 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. 22 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 23 | } 24 | 25 | func applicationDidEnterBackground(_ application: UIApplication) { 26 | // 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. 27 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 28 | } 29 | 30 | func applicationWillEnterForeground(_ application: UIApplication) { 31 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 32 | } 33 | 34 | func applicationDidBecomeActive(_ application: UIApplication) { 35 | // 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. 36 | } 37 | 38 | func applicationWillTerminate(_ application: UIApplication) { 39 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 40 | } 41 | 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Example/Example/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Example/Example/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Example/Example/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /Example/Example/DynamicNavigationBar/DynamicNavigationBar.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Example 3 | // 4 | // Copyright © 2018 Muhammad Bassio. All rights reserved. 5 | // 6 | 7 | import UIKit 8 | 9 | open class DynamicNavigationBar: UIView { 10 | public var menuView: UIView? 11 | public var barView: UIView? 12 | public var overlayButton: UIButton? 13 | 14 | func updateState(percentage:CGFloat, radius:CGFloat) { 15 | let newAlpha = (percentage > 1) ? 1 : ((percentage < 0) ? 0 : percentage) 16 | self.overlayButton?.alpha = newAlpha 17 | self.menuView?.alpha = newAlpha 18 | self.barView?.alpha = 1 - newAlpha 19 | self.menuView?.clipsToBounds = true 20 | self.barView?.clipsToBounds = true 21 | self.clipsToBounds = true 22 | self.menuView?.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner] 23 | self.barView?.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner] 24 | self.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner] 25 | self.menuView?.layer.cornerRadius = radius * percentage 26 | self.barView?.layer.cornerRadius = radius * percentage 27 | self.layer.cornerRadius = radius * percentage 28 | } 29 | 30 | func showMenu(radius:CGFloat) { 31 | UIView.animate(withDuration: 0.35) { 32 | self.overlayButton?.isUserInteractionEnabled = true 33 | self.overlayButton?.alpha = 1 34 | self.menuView?.alpha = 1 35 | self.barView?.alpha = 0 36 | self.menuView?.clipsToBounds = true 37 | self.barView?.clipsToBounds = true 38 | self.clipsToBounds = true 39 | self.menuView?.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner] 40 | self.barView?.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner] 41 | self.layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner] 42 | self.menuView?.layer.cornerRadius = radius 43 | self.barView?.layer.cornerRadius = radius 44 | self.layer.cornerRadius = radius 45 | } 46 | } 47 | 48 | @objc func hideMenu() { 49 | UIView.animate(withDuration: 0.35) { 50 | self.overlayButton?.isUserInteractionEnabled = false 51 | self.overlayButton?.alpha = 0 52 | self.menuView?.alpha = 0 53 | self.barView?.alpha = 1 54 | self.menuView?.layer.cornerRadius = 0 55 | self.barView?.layer.cornerRadius = 0 56 | self.layer.cornerRadius = 0 57 | } 58 | } 59 | 60 | 61 | } 62 | -------------------------------------------------------------------------------- /Example/Example/DynamicNavigationBar/DynamicViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Example 3 | // 4 | // Copyright © 2018 Muhammad Bassio. All rights reserved. 5 | // 6 | 7 | import UIKit 8 | 9 | open class DynamicViewController: UIViewController, UIScrollViewDelegate { 10 | 11 | static var ScrollThreshold:CGFloat = 100 12 | 13 | @IBOutlet public var barHeightConstraint: NSLayoutConstraint? 14 | @IBOutlet public var viewTopConstraint: NSLayoutConstraint? 15 | @IBOutlet public var navigationBar: DynamicNavigationBar? 16 | @IBOutlet public var menuView: UIView? 17 | @IBOutlet public var navigationBarView: UIView? 18 | @IBOutlet public var overlayButton: UIButton? 19 | 20 | @IBInspectable public var navigationBarMinHeight:CGFloat = 44 { 21 | didSet { 22 | if self.navigationBarMinHeight > self.navigationBarMaxHeight { 23 | self.navigationBarMaxHeight = self.navigationBarMinHeight 24 | } 25 | if let const = self.barHeightConstraint?.constant { 26 | if self.navigationBarMinHeight > const { 27 | self.barHeightConstraint?.constant = self.navigationBarMinHeight 28 | } 29 | } 30 | } 31 | } 32 | 33 | @IBInspectable public var navigationBarMaxHeight:CGFloat = 80 { 34 | didSet { 35 | if self.navigationBarMinHeight > self.navigationBarMaxHeight { 36 | self.navigationBarMinHeight = self.navigationBarMaxHeight 37 | } 38 | if let const = self.barHeightConstraint?.constant { 39 | if self.navigationBarMaxHeight < const { 40 | self.barHeightConstraint?.constant = self.navigationBarMaxHeight 41 | } 42 | } 43 | } 44 | } 45 | 46 | @IBInspectable public var menuCornerRadius: CGFloat = 15 47 | 48 | @IBInspectable public var navigationBarExtensionHeight:CGFloat = 60 { 49 | didSet { 50 | if self.navigationBarExtensionHeight != 0 { 51 | if self.navigationBarExtensionHeight > 0 { 52 | if self.navigationBarExtensionHeight < self.navigationBarMaxHeight { 53 | self.navigationBarExtensionHeight = self.navigationBarMaxHeight 54 | } 55 | } else { 56 | self.navigationBarExtensionHeight = 0 57 | } 58 | } 59 | } 60 | } 61 | 62 | 63 | public var isDragging = false 64 | 65 | open override func viewDidLoad() { 66 | super.viewDidLoad() 67 | self.navigationBar?.barView = self.navigationBarView 68 | self.navigationBar?.menuView = self.menuView 69 | self.navigationBar?.overlayButton = self.overlayButton 70 | self.barHeightConstraint?.constant = self.navigationBarMaxHeight 71 | self.viewTopConstraint?.constant = self.navigationBarMaxHeight 72 | self.navigationBar?.hideMenu() 73 | } 74 | 75 | @IBAction func closeMenu() { 76 | UIView.animate(withDuration: 0.35) { 77 | self.barHeightConstraint?.constant = self.navigationBarMaxHeight 78 | self.view.layoutIfNeeded() 79 | self.navigationBar?.hideMenu() 80 | } 81 | } 82 | 83 | open func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { 84 | self.isDragging = true 85 | } 86 | 87 | open func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) { 88 | self.isDragging = false 89 | let offset = scrollView.contentOffset.y 90 | 91 | if offset < 0 { 92 | UIView.animate(withDuration: 0.35) { 93 | if offset < -DynamicViewController.ScrollThreshold { 94 | let extraHeight = (self.navigationBarExtensionHeight > 0) ? self.navigationBarExtensionHeight : scrollView.bounds.height 95 | self.barHeightConstraint?.constant = self.navigationBarMaxHeight + extraHeight 96 | self.navigationBar?.showMenu(radius: self.menuCornerRadius) 97 | } else { 98 | self.barHeightConstraint?.constant = self.navigationBarMaxHeight 99 | self.viewTopConstraint?.constant = self.navigationBarMaxHeight 100 | self.navigationBar?.hideMenu() 101 | } 102 | self.view.layoutIfNeeded() 103 | } 104 | } else { 105 | let diff = self.navigationBarMaxHeight - self.navigationBarMinHeight 106 | UIView.animate(withDuration: 0.35) { 107 | if offset < diff { 108 | self.barHeightConstraint?.constant = self.navigationBarMaxHeight - offset 109 | self.viewTopConstraint?.constant = self.navigationBarMaxHeight - offset 110 | } else { 111 | self.barHeightConstraint?.constant = self.navigationBarMinHeight 112 | self.viewTopConstraint?.constant = self.navigationBarMinHeight 113 | } 114 | self.view.layoutIfNeeded() 115 | self.navigationBar?.hideMenu() 116 | } 117 | } 118 | } 119 | 120 | open func scrollViewDidScroll(_ scrollView: UIScrollView) { 121 | let offset = scrollView.contentOffset.y 122 | if offset <= 0 { 123 | if self.isDragging { 124 | let maxHeight = (self.navigationBarExtensionHeight > 0) ? max(self.navigationBarExtensionHeight, DynamicViewController.ScrollThreshold) : scrollView.bounds.height 125 | let percentage = -offset / maxHeight 126 | self.barHeightConstraint?.constant = self.navigationBarMaxHeight - offset 127 | self.navigationBar?.updateState(percentage: percentage, radius: self.menuCornerRadius) 128 | } 129 | } else { 130 | self.navigationBar?.updateState(percentage: 0, radius: self.menuCornerRadius) 131 | let diff = self.navigationBarMaxHeight - self.navigationBarMinHeight 132 | if offset < diff { 133 | self.barHeightConstraint?.constant = self.navigationBarMaxHeight - offset 134 | self.viewTopConstraint?.constant = self.navigationBarMaxHeight - offset 135 | } else { 136 | self.barHeightConstraint?.constant = self.navigationBarMinHeight 137 | self.viewTopConstraint?.constant = self.navigationBarMinHeight 138 | } 139 | } 140 | } 141 | 142 | } 143 | 144 | -------------------------------------------------------------------------------- /Example/Example/Example.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | aps-environment 6 | development 7 | 8 | 9 | -------------------------------------------------------------------------------- /Example/Example/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Example/Example/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Example 3 | // 4 | // Copyright © 2018 Muhammad Bassio. All rights reserved. 5 | // 6 | 7 | import UIKit 8 | 9 | class ViewController: DynamicViewController { 10 | 11 | override var supportedInterfaceOrientations: UIInterfaceOrientationMask { 12 | return .portrait 13 | } 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | } 18 | 19 | 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Muhammad Bassio 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dynamic NavigationBar 2 | A navigation bar that can be expanded to show a more content by dragging. 3 | 4 | ![Demo](demo.gif) 5 | 6 | 7 | 8 | ## Requirements 9 | 10 | - iOS 11.0+ 11 | - Xcode 10.0 12 | - Swift 4.2 13 | 14 | ## 15 | 16 | ## Installation 17 | 18 | ##### CocoaPods 19 | 20 | [CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: 21 | 22 | ```bash 23 | $ gem install cocoapods 24 | ``` 25 | 26 | To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`: 27 | 28 | ```ruby 29 | source 'https://github.com/CocoaPods/Specs.git' 30 | platform :ios, '11.0' 31 | use_frameworks! 32 | 33 | target '' do 34 | pod 'DynamicNavigationBar' 35 | end 36 | ``` 37 | 38 | Then, run the following command: 39 | 40 | ```bash 41 | $ pod install 42 | ``` 43 | 44 | 45 | 46 | ##### Manual 47 | 48 | Drag the folder "DynamicNavigationBar" to your Xcode project 49 | 50 | ## How to Use: 51 | 52 | Check the included Example. 53 | 54 | ## License 55 | 56 | MIT License (MIT) 57 | 58 | ``` 59 | Copyright (c) 2018 MuhammadBassio 60 | 61 | Permission is hereby granted, free of charge, to any person obtaining a copy 62 | of this software and associated documentation files (the "Software"), to deal 63 | in the Software without restriction, including without limitation the rights 64 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 65 | copies of the Software, and to permit persons to whom the Software is 66 | furnished to do so, subject to the following conditions: 67 | 68 | The above copyright notice and this permission notice shall be included in 69 | all copies or substantial portions of the Software. 70 | 71 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 72 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 73 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 74 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 75 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 76 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 77 | THE SOFTWARE. 78 | ``` 79 | 80 | -------------------------------------------------------------------------------- /demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muhammadbassio/DynamicNavigationBar/df531a79b54c2f7299f1e0e8c7a9cbdaa462c072/demo.gif --------------------------------------------------------------------------------