├── .DS_Store ├── GradientNavBarDemo.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── diegobustamante.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── diegobustamante.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── GradientNavBarDemo ├── AppDelegate.swift ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── SceneDelegate.swift ├── UIViewControllerExtensions.swift └── ViewController.swift └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ModernProgrammer/GradientNavBarDemo/04b00783e426b9eb90a676e0a2a5dd04b124bcfa/.DS_Store -------------------------------------------------------------------------------- /GradientNavBarDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | B206E94323F09C3100A8F26B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B206E94223F09C3100A8F26B /* AppDelegate.swift */; }; 11 | B206E94523F09C3100A8F26B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B206E94423F09C3100A8F26B /* SceneDelegate.swift */; }; 12 | B206E94723F09C3100A8F26B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = B206E94623F09C3100A8F26B /* ViewController.swift */; }; 13 | B206E94A23F09C3100A8F26B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B206E94823F09C3100A8F26B /* Main.storyboard */; }; 14 | B206E94C23F09C3200A8F26B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B206E94B23F09C3200A8F26B /* Assets.xcassets */; }; 15 | B206E94F23F09C3200A8F26B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B206E94D23F09C3200A8F26B /* LaunchScreen.storyboard */; }; 16 | B206E95723F0A8F200A8F26B /* UIViewControllerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = B206E95623F0A8F200A8F26B /* UIViewControllerExtensions.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | B206E93F23F09C3100A8F26B /* GradientNavBarDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GradientNavBarDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | B206E94223F09C3100A8F26B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | B206E94423F09C3100A8F26B /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 23 | B206E94623F09C3100A8F26B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | B206E94923F09C3100A8F26B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | B206E94B23F09C3200A8F26B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | B206E94E23F09C3200A8F26B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | B206E95023F09C3200A8F26B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | B206E95623F0A8F200A8F26B /* UIViewControllerExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIViewControllerExtensions.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | B206E93C23F09C3100A8F26B /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | B206E93623F09C3100A8F26B = { 43 | isa = PBXGroup; 44 | children = ( 45 | B206E94123F09C3100A8F26B /* GradientNavBarDemo */, 46 | B206E94023F09C3100A8F26B /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | B206E94023F09C3100A8F26B /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | B206E93F23F09C3100A8F26B /* GradientNavBarDemo.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | B206E94123F09C3100A8F26B /* GradientNavBarDemo */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | B206E95623F0A8F200A8F26B /* UIViewControllerExtensions.swift */, 62 | B206E94223F09C3100A8F26B /* AppDelegate.swift */, 63 | B206E94423F09C3100A8F26B /* SceneDelegate.swift */, 64 | B206E94623F09C3100A8F26B /* ViewController.swift */, 65 | B206E94823F09C3100A8F26B /* Main.storyboard */, 66 | B206E94B23F09C3200A8F26B /* Assets.xcassets */, 67 | B206E94D23F09C3200A8F26B /* LaunchScreen.storyboard */, 68 | B206E95023F09C3200A8F26B /* Info.plist */, 69 | ); 70 | path = GradientNavBarDemo; 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | B206E93E23F09C3100A8F26B /* GradientNavBarDemo */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = B206E95323F09C3200A8F26B /* Build configuration list for PBXNativeTarget "GradientNavBarDemo" */; 79 | buildPhases = ( 80 | B206E93B23F09C3100A8F26B /* Sources */, 81 | B206E93C23F09C3100A8F26B /* Frameworks */, 82 | B206E93D23F09C3100A8F26B /* Resources */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = GradientNavBarDemo; 89 | productName = GradientNavBarDemo; 90 | productReference = B206E93F23F09C3100A8F26B /* GradientNavBarDemo.app */; 91 | productType = "com.apple.product-type.application"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | B206E93723F09C3100A8F26B /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | LastSwiftUpdateCheck = 1130; 100 | LastUpgradeCheck = 1130; 101 | ORGANIZATIONNAME = "Diego Bustamante"; 102 | TargetAttributes = { 103 | B206E93E23F09C3100A8F26B = { 104 | CreatedOnToolsVersion = 11.3.1; 105 | }; 106 | }; 107 | }; 108 | buildConfigurationList = B206E93A23F09C3100A8F26B /* Build configuration list for PBXProject "GradientNavBarDemo" */; 109 | compatibilityVersion = "Xcode 9.3"; 110 | developmentRegion = en; 111 | hasScannedForEncodings = 0; 112 | knownRegions = ( 113 | en, 114 | Base, 115 | ); 116 | mainGroup = B206E93623F09C3100A8F26B; 117 | productRefGroup = B206E94023F09C3100A8F26B /* Products */; 118 | projectDirPath = ""; 119 | projectRoot = ""; 120 | targets = ( 121 | B206E93E23F09C3100A8F26B /* GradientNavBarDemo */, 122 | ); 123 | }; 124 | /* End PBXProject section */ 125 | 126 | /* Begin PBXResourcesBuildPhase section */ 127 | B206E93D23F09C3100A8F26B /* Resources */ = { 128 | isa = PBXResourcesBuildPhase; 129 | buildActionMask = 2147483647; 130 | files = ( 131 | B206E94F23F09C3200A8F26B /* LaunchScreen.storyboard in Resources */, 132 | B206E94C23F09C3200A8F26B /* Assets.xcassets in Resources */, 133 | B206E94A23F09C3100A8F26B /* Main.storyboard in Resources */, 134 | ); 135 | runOnlyForDeploymentPostprocessing = 0; 136 | }; 137 | /* End PBXResourcesBuildPhase section */ 138 | 139 | /* Begin PBXSourcesBuildPhase section */ 140 | B206E93B23F09C3100A8F26B /* Sources */ = { 141 | isa = PBXSourcesBuildPhase; 142 | buildActionMask = 2147483647; 143 | files = ( 144 | B206E95723F0A8F200A8F26B /* UIViewControllerExtensions.swift in Sources */, 145 | B206E94723F09C3100A8F26B /* ViewController.swift in Sources */, 146 | B206E94323F09C3100A8F26B /* AppDelegate.swift in Sources */, 147 | B206E94523F09C3100A8F26B /* SceneDelegate.swift in Sources */, 148 | ); 149 | runOnlyForDeploymentPostprocessing = 0; 150 | }; 151 | /* End PBXSourcesBuildPhase section */ 152 | 153 | /* Begin PBXVariantGroup section */ 154 | B206E94823F09C3100A8F26B /* Main.storyboard */ = { 155 | isa = PBXVariantGroup; 156 | children = ( 157 | B206E94923F09C3100A8F26B /* Base */, 158 | ); 159 | name = Main.storyboard; 160 | sourceTree = ""; 161 | }; 162 | B206E94D23F09C3200A8F26B /* LaunchScreen.storyboard */ = { 163 | isa = PBXVariantGroup; 164 | children = ( 165 | B206E94E23F09C3200A8F26B /* Base */, 166 | ); 167 | name = LaunchScreen.storyboard; 168 | sourceTree = ""; 169 | }; 170 | /* End PBXVariantGroup section */ 171 | 172 | /* Begin XCBuildConfiguration section */ 173 | B206E95123F09C3200A8F26B /* Debug */ = { 174 | isa = XCBuildConfiguration; 175 | buildSettings = { 176 | ALWAYS_SEARCH_USER_PATHS = NO; 177 | CLANG_ANALYZER_NONNULL = YES; 178 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 180 | CLANG_CXX_LIBRARY = "libc++"; 181 | CLANG_ENABLE_MODULES = YES; 182 | CLANG_ENABLE_OBJC_ARC = YES; 183 | CLANG_ENABLE_OBJC_WEAK = YES; 184 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_COMMA = YES; 187 | CLANG_WARN_CONSTANT_CONVERSION = YES; 188 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 190 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 191 | CLANG_WARN_EMPTY_BODY = YES; 192 | CLANG_WARN_ENUM_CONVERSION = YES; 193 | CLANG_WARN_INFINITE_RECURSION = YES; 194 | CLANG_WARN_INT_CONVERSION = YES; 195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 196 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 197 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 199 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 200 | CLANG_WARN_STRICT_PROTOTYPES = YES; 201 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 202 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 203 | CLANG_WARN_UNREACHABLE_CODE = YES; 204 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 205 | COPY_PHASE_STRIP = NO; 206 | DEBUG_INFORMATION_FORMAT = dwarf; 207 | ENABLE_STRICT_OBJC_MSGSEND = YES; 208 | ENABLE_TESTABILITY = YES; 209 | GCC_C_LANGUAGE_STANDARD = gnu11; 210 | GCC_DYNAMIC_NO_PIC = NO; 211 | GCC_NO_COMMON_BLOCKS = YES; 212 | GCC_OPTIMIZATION_LEVEL = 0; 213 | GCC_PREPROCESSOR_DEFINITIONS = ( 214 | "DEBUG=1", 215 | "$(inherited)", 216 | ); 217 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 218 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 219 | GCC_WARN_UNDECLARED_SELECTOR = YES; 220 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 221 | GCC_WARN_UNUSED_FUNCTION = YES; 222 | GCC_WARN_UNUSED_VARIABLE = YES; 223 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 224 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 225 | MTL_FAST_MATH = YES; 226 | ONLY_ACTIVE_ARCH = YES; 227 | SDKROOT = iphoneos; 228 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 229 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 230 | }; 231 | name = Debug; 232 | }; 233 | B206E95223F09C3200A8F26B /* Release */ = { 234 | isa = XCBuildConfiguration; 235 | buildSettings = { 236 | ALWAYS_SEARCH_USER_PATHS = NO; 237 | CLANG_ANALYZER_NONNULL = YES; 238 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 240 | CLANG_CXX_LIBRARY = "libc++"; 241 | CLANG_ENABLE_MODULES = YES; 242 | CLANG_ENABLE_OBJC_ARC = YES; 243 | CLANG_ENABLE_OBJC_WEAK = YES; 244 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 245 | CLANG_WARN_BOOL_CONVERSION = YES; 246 | CLANG_WARN_COMMA = YES; 247 | CLANG_WARN_CONSTANT_CONVERSION = YES; 248 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INFINITE_RECURSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 260 | CLANG_WARN_STRICT_PROTOTYPES = YES; 261 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 262 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 263 | CLANG_WARN_UNREACHABLE_CODE = YES; 264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 267 | ENABLE_NS_ASSERTIONS = NO; 268 | ENABLE_STRICT_OBJC_MSGSEND = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu11; 270 | GCC_NO_COMMON_BLOCKS = YES; 271 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 272 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 273 | GCC_WARN_UNDECLARED_SELECTOR = YES; 274 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 275 | GCC_WARN_UNUSED_FUNCTION = YES; 276 | GCC_WARN_UNUSED_VARIABLE = YES; 277 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 278 | MTL_ENABLE_DEBUG_INFO = NO; 279 | MTL_FAST_MATH = YES; 280 | SDKROOT = iphoneos; 281 | SWIFT_COMPILATION_MODE = wholemodule; 282 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 283 | VALIDATE_PRODUCT = YES; 284 | }; 285 | name = Release; 286 | }; 287 | B206E95423F09C3200A8F26B /* Debug */ = { 288 | isa = XCBuildConfiguration; 289 | buildSettings = { 290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 291 | CODE_SIGN_STYLE = Automatic; 292 | DEVELOPMENT_TEAM = XREP97TJKH; 293 | INFOPLIST_FILE = GradientNavBarDemo/Info.plist; 294 | LD_RUNPATH_SEARCH_PATHS = ( 295 | "$(inherited)", 296 | "@executable_path/Frameworks", 297 | ); 298 | PRODUCT_BUNDLE_IDENTIFIER = GradientNavBarDemo.GradientNavBarDemo; 299 | PRODUCT_NAME = "$(TARGET_NAME)"; 300 | SWIFT_VERSION = 5.0; 301 | TARGETED_DEVICE_FAMILY = "1,2"; 302 | }; 303 | name = Debug; 304 | }; 305 | B206E95523F09C3200A8F26B /* Release */ = { 306 | isa = XCBuildConfiguration; 307 | buildSettings = { 308 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 309 | CODE_SIGN_STYLE = Automatic; 310 | DEVELOPMENT_TEAM = XREP97TJKH; 311 | INFOPLIST_FILE = GradientNavBarDemo/Info.plist; 312 | LD_RUNPATH_SEARCH_PATHS = ( 313 | "$(inherited)", 314 | "@executable_path/Frameworks", 315 | ); 316 | PRODUCT_BUNDLE_IDENTIFIER = GradientNavBarDemo.GradientNavBarDemo; 317 | PRODUCT_NAME = "$(TARGET_NAME)"; 318 | SWIFT_VERSION = 5.0; 319 | TARGETED_DEVICE_FAMILY = "1,2"; 320 | }; 321 | name = Release; 322 | }; 323 | /* End XCBuildConfiguration section */ 324 | 325 | /* Begin XCConfigurationList section */ 326 | B206E93A23F09C3100A8F26B /* Build configuration list for PBXProject "GradientNavBarDemo" */ = { 327 | isa = XCConfigurationList; 328 | buildConfigurations = ( 329 | B206E95123F09C3200A8F26B /* Debug */, 330 | B206E95223F09C3200A8F26B /* Release */, 331 | ); 332 | defaultConfigurationIsVisible = 0; 333 | defaultConfigurationName = Release; 334 | }; 335 | B206E95323F09C3200A8F26B /* Build configuration list for PBXNativeTarget "GradientNavBarDemo" */ = { 336 | isa = XCConfigurationList; 337 | buildConfigurations = ( 338 | B206E95423F09C3200A8F26B /* Debug */, 339 | B206E95523F09C3200A8F26B /* Release */, 340 | ); 341 | defaultConfigurationIsVisible = 0; 342 | defaultConfigurationName = Release; 343 | }; 344 | /* End XCConfigurationList section */ 345 | }; 346 | rootObject = B206E93723F09C3100A8F26B /* Project object */; 347 | } 348 | -------------------------------------------------------------------------------- /GradientNavBarDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /GradientNavBarDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /GradientNavBarDemo.xcodeproj/project.xcworkspace/xcuserdata/diegobustamante.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ModernProgrammer/GradientNavBarDemo/04b00783e426b9eb90a676e0a2a5dd04b124bcfa/GradientNavBarDemo.xcodeproj/project.xcworkspace/xcuserdata/diegobustamante.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /GradientNavBarDemo.xcodeproj/xcuserdata/diegobustamante.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | GradientNavBarDemo.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /GradientNavBarDemo/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // GradientNavBarDemo 4 | // 5 | // Created by Diego Bustamante on 2/9/20. 6 | // Copyright © 2020 Diego Bustamante. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /GradientNavBarDemo/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 | } -------------------------------------------------------------------------------- /GradientNavBarDemo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /GradientNavBarDemo/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 | -------------------------------------------------------------------------------- /GradientNavBarDemo/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 | -------------------------------------------------------------------------------- /GradientNavBarDemo/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 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UILaunchStoryboardName 43 | LaunchScreen 44 | UIMainStoryboardFile 45 | Main 46 | UIRequiredDeviceCapabilities 47 | 48 | armv7 49 | 50 | UISupportedInterfaceOrientations 51 | 52 | UIInterfaceOrientationPortrait 53 | UIInterfaceOrientationLandscapeLeft 54 | UIInterfaceOrientationLandscapeRight 55 | 56 | UISupportedInterfaceOrientations~ipad 57 | 58 | UIInterfaceOrientationPortrait 59 | UIInterfaceOrientationPortraitUpsideDown 60 | UIInterfaceOrientationLandscapeLeft 61 | UIInterfaceOrientationLandscapeRight 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /GradientNavBarDemo/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // GradientNavBarDemo 4 | // 5 | // Created by Diego Bustamante on 2/9/20. 6 | // Copyright © 2020 Diego Bustamante. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | guard let windowScene = (scene as? UIWindowScene) else { return } 18 | self.window = UIWindow(windowScene: windowScene) 19 | let viewController = ViewController() 20 | let navViewController = UINavigationController(rootViewController: viewController) 21 | self.window?.rootViewController = navViewController 22 | self.window?.makeKeyAndVisible() 23 | } 24 | 25 | func sceneDidDisconnect(_ scene: UIScene) { 26 | // Called as the scene is being released by the system. 27 | // This occurs shortly after the scene enters the background, or when its session is discarded. 28 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 29 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 30 | } 31 | 32 | func sceneDidBecomeActive(_ scene: UIScene) { 33 | // Called when the scene has moved from an inactive state to an active state. 34 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 35 | } 36 | 37 | func sceneWillResignActive(_ scene: UIScene) { 38 | // Called when the scene will move from an active state to an inactive state. 39 | // This may occur due to temporary interruptions (ex. an incoming phone call). 40 | } 41 | 42 | func sceneWillEnterForeground(_ scene: UIScene) { 43 | // Called as the scene transitions from the background to the foreground. 44 | // Use this method to undo the changes made on entering the background. 45 | } 46 | 47 | func sceneDidEnterBackground(_ scene: UIScene) { 48 | // Called as the scene transitions from the foreground to the background. 49 | // Use this method to save data, release shared resources, and store enough scene-specific state information 50 | // to restore the scene back to its current state. 51 | } 52 | 53 | 54 | } 55 | 56 | -------------------------------------------------------------------------------- /GradientNavBarDemo/UIViewControllerExtensions.swift: -------------------------------------------------------------------------------- 1 | // 2 | // UIViewControllerExtensions.swift 3 | // GradientNavBarDemo 4 | // 5 | // Created by Diego Bustamante on 2/9/20. 6 | // Copyright © 2020 Diego Bustamante. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | extension UIViewController { 12 | func setupClearNavBar() { 13 | navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) 14 | navigationController?.navigationBar.shadowImage = UIImage() 15 | navigationController?.navigationBar.barTintColor = .clear 16 | navigationController?.navigationBar.isTranslucent = true 17 | } 18 | 19 | func setupGradient(height: CGFloat, topColor: CGColor, bottomColor: CGColor) -> CAGradientLayer { 20 | let gradient: CAGradientLayer = CAGradientLayer() 21 | gradient.colors = [topColor,bottomColor] 22 | gradient.locations = [0.0 , 1.0] 23 | gradient.startPoint = CGPoint(x: 0.0, y: 0.0) 24 | gradient.endPoint = CGPoint(x: 0.0, y: 1.0) 25 | gradient.frame = CGRect(x: 0.0, y: 0.0, width: self.view.frame.size.width, height: height) 26 | return gradient 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GradientNavBarDemo/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // GradientNavBarDemo 4 | // 5 | // Created by Diego Bustamante on 2/9/20. 6 | // Copyright © 2020 Diego Bustamante. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout { 12 | 13 | let cellId = "cellId" 14 | lazy var collectionView : UICollectionView = { 15 | let layout = UICollectionViewFlowLayout() 16 | let collectionView = UICollectionView(frame: view.frame, collectionViewLayout: layout) 17 | collectionView.dataSource = self 18 | collectionView.delegate = self 19 | collectionView.alwaysBounceVertical = true 20 | collectionView.contentInsetAdjustmentBehavior = .never 21 | collectionView.showsVerticalScrollIndicator = false 22 | collectionView.backgroundColor = .clear 23 | collectionView.register(UICollectionViewCell.self, forCellWithReuseIdentifier: cellId) 24 | return collectionView 25 | }() 26 | 27 | var gradient : CAGradientLayer? 28 | let gradientView : UIView = { 29 | let view = UIView() 30 | return view 31 | }() 32 | 33 | override func viewDidLoad() { 34 | super.viewDidLoad() 35 | // Do any additional setup after loading the view. 36 | navigationItem.title = "A NavBar" 37 | setupCollectionView() 38 | setupClearNavBar() 39 | setupGradient() 40 | } 41 | 42 | func setupCollectionView() { 43 | view.addSubview(collectionView) 44 | NSLayoutConstraint.activate([ 45 | collectionView.topAnchor.constraint(equalTo: view.topAnchor), 46 | collectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor), 47 | collectionView.leftAnchor.constraint(equalTo: view.leftAnchor), 48 | collectionView.rightAnchor.constraint(equalTo: view.rightAnchor) 49 | ]) 50 | } 51 | 52 | func setupGradient() { 53 | // Calculates the size of NavBar (Either large or normal) 54 | //guard let height = navigationController?.navigationBar.frame.height else { return } 55 | let height : CGFloat = 90 56 | let color = UIColor.black.withAlphaComponent(0.7).cgColor 57 | let clear = UIColor.black.withAlphaComponent(0.0).cgColor 58 | gradient = setupGradient(height: height, topColor: color,bottomColor: clear) 59 | view.addSubview(gradientView) 60 | NSLayoutConstraint.activate([ 61 | gradientView.topAnchor.constraint(equalTo: view.topAnchor), 62 | gradientView.leftAnchor.constraint(equalTo: view.leftAnchor), 63 | ]) 64 | gradientView.layer.insertSublayer(gradient!, at: 0) 65 | } 66 | } 67 | 68 | extension ViewController { 69 | func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { 70 | return 42 71 | } 72 | 73 | func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { 74 | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: cellId, for: indexPath) 75 | cell.backgroundColor = .red 76 | return cell 77 | } 78 | 79 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { 80 | let size = view.frame.width/3 - 1 81 | return CGSize(width: size, height: size) 82 | } 83 | 84 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { 85 | return 1 86 | } 87 | 88 | func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumInteritemSpacingForSectionAt section: Int) -> CGFloat { 89 | return 1 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GradientNavBarDemo 2 | --------------------------------------------------------------------------------