Repository: D-32/MiniTabBar Branch: master Commit: 88316e88a9ba Files: 25 Total size: 50.1 KB Directory structure: gitextract_02zc56kq/ ├── .gitignore ├── Example/ │ ├── MiniTabBar/ │ │ ├── AppDelegate.swift │ │ ├── Base.lproj/ │ │ │ ├── LaunchScreen.xib │ │ │ └── Main.storyboard │ │ ├── Images.xcassets/ │ │ │ ├── AppIcon.appiconset/ │ │ │ │ └── Contents.json │ │ │ ├── Contents.json │ │ │ ├── tab1.imageset/ │ │ │ │ └── Contents.json │ │ │ ├── tab2.imageset/ │ │ │ │ └── Contents.json │ │ │ └── tab3.imageset/ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── ViewController.swift │ ├── MiniTabBar.xcodeproj/ │ │ ├── project.pbxproj │ │ ├── project.xcworkspace/ │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata/ │ │ └── xcschemes/ │ │ └── MiniTabBar-Example.xcscheme │ ├── MiniTabBar.xcworkspace/ │ │ └── contents.xcworkspacedata │ ├── Podfile │ └── Tests/ │ ├── Info.plist │ └── Tests.swift ├── LICENSE ├── MiniTabBar/ │ ├── Assets/ │ │ └── .gitkeep │ └── Classes/ │ ├── .gitkeep │ ├── MiniTabBar.swift │ └── MiniTabBarItemView.swift ├── MiniTabBar.podspec └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Xcode # # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore ## Build generated build/ DerivedData/ ## Various settings *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata/ ## Other *.moved-aside *.xcuserstate ## Obj-C/Swift specific *.hmap *.ipa *.dSYM.zip *.dSYM ## Playgrounds timeline.xctimeline playground.xcworkspace # Swift Package Manager # # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. # Packages/ .build/ # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # Pods/ Podfile.lock # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. # Carthage/Checkouts Carthage/Build # fastlane # # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the # screenshots whenever they are needed. # For more information about the recommended setup visit: # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md fastlane/report.xml fastlane/Preview.html fastlane/screenshots fastlane/test_output .DS_Store ================================================ FILE: Example/MiniTabBar/AppDelegate.swift ================================================ // // AppDelegate.swift // MiniTabBar // // Created by Dylan Marriott on 01/11/2017. // Copyright (c) 2017 Dylan Marriott. All rights reserved. // import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. return true } func applicationWillResignActive(_ application: UIApplication) { // 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. // 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. } func applicationDidEnterBackground(_ application: UIApplication) { // 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. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } func applicationWillEnterForeground(_ application: UIApplication) { // 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. } func applicationDidBecomeActive(_ application: UIApplication) { // 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. } func applicationWillTerminate(_ application: UIApplication) { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } } ================================================ FILE: Example/MiniTabBar/Base.lproj/LaunchScreen.xib ================================================ ================================================ FILE: Example/MiniTabBar/Base.lproj/Main.storyboard ================================================ ================================================ FILE: Example/MiniTabBar/Images.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "20x20", "scale" : "2x" }, { "idiom" : "iphone", "size" : "20x20", "scale" : "3x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" }, { "idiom" : "ios-marketing", "size" : "1024x1024", "scale" : "1x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/MiniTabBar/Images.xcassets/Contents.json ================================================ { "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/MiniTabBar/Images.xcassets/tab1.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "idiom" : "universal", "filename" : "tab1.png", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/MiniTabBar/Images.xcassets/tab2.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "idiom" : "universal", "filename" : "tab2.png", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/MiniTabBar/Images.xcassets/tab3.imageset/Contents.json ================================================ { "images" : [ { "idiom" : "universal", "scale" : "1x" }, { "idiom" : "universal", "filename" : "tab3.png", "scale" : "2x" }, { "idiom" : "universal", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: Example/MiniTabBar/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft ================================================ FILE: Example/MiniTabBar/ViewController.swift ================================================ // // ViewController.swift // MiniTabBar // // Created by Dylan Marriott on 01/11/2017. // Copyright (c) 2017 Dylan Marriott. All rights reserved. // import UIKit import MiniTabBar class ViewController: UIViewController, MiniTabBarDelegate { override func viewDidLoad() { super.viewDidLoad() self.createSimpleTabBar() //self.createCustomItemTabBar() } private func createSimpleTabBar() { var items = [MiniTabBarItem]() items.append(MiniTabBarItem(title: "Home", icon: #imageLiteral(resourceName: "tab1"))) items.append(MiniTabBarItem(title: "Profile", icon: #imageLiteral(resourceName: "tab2"))) items.append(MiniTabBarItem(title: "Tickets", icon: #imageLiteral(resourceName: "tab3"))) let tabBar = MiniTabBar(items: items) tabBar.translatesAutoresizingMaskIntoConstraints = false tabBar.delegate = self self.view.addSubview(tabBar) let constraints = [ tabBar.bottomAnchor.constraint(equalTo: view.layoutMarginsGuide.bottomAnchor), tabBar.widthAnchor.constraint(equalTo: view.widthAnchor), tabBar.heightAnchor.constraint(equalToConstant: 44), ] NSLayoutConstraint.activate(constraints) } private func createCustomItemTabBar() { var items = [MiniTabBarItem]() items.append(MiniTabBarItem(title: "Home", icon: #imageLiteral(resourceName: "tab1"))) let customButton = UIButton() customButton.backgroundColor = UIColor.orange customButton.layer.cornerRadius = 4 customButton.frame.size = CGSize(width: 50, height: 50) customButton.addTarget(self, action: #selector(customButtonTapped), for: .touchUpInside) let customItem = MiniTabBarItem(customView: customButton, offset: UIOffset(horizontal: 0, vertical: -10)) customItem.selectable = false items.append(customItem) items.append(MiniTabBarItem(title: "Tickets", icon: #imageLiteral(resourceName: "tab3"))) let tabBar = MiniTabBar(items: items) tabBar.translatesAutoresizingMaskIntoConstraints = false tabBar.delegate = self self.view.addSubview(tabBar) let constraints = [ tabBar.bottomAnchor.constraint(equalTo: view.layoutMarginsGuide.bottomAnchor), tabBar.widthAnchor.constraint(equalTo: view.widthAnchor), tabBar.heightAnchor.constraint(equalToConstant: 44), ] NSLayoutConstraint.activate(constraints) } func tabSelected(_ index: Int) { print("Selected tab: ", index) } @objc private func customButtonTapped() { print("Custom button tapped") } } ================================================ FILE: Example/MiniTabBar.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; }; 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; }; 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; }; 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; }; 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; }; 62B14762227F09369F1BF69B /* Pods_MiniTabBar_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8ABE17B41217A06B3F492A90 /* Pods_MiniTabBar_Example.framework */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 3E3B9FC0C368F181DFC0EA4C /* Pods-MiniTabBar_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MiniTabBar_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-MiniTabBar_Tests/Pods-MiniTabBar_Tests.release.xcconfig"; sourceTree = ""; }; 5977A86A2DB4E50719E1D312 /* Pods-MiniTabBar_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MiniTabBar_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-MiniTabBar_Example/Pods-MiniTabBar_Example.release.xcconfig"; sourceTree = ""; }; 607FACD01AFB9204008FA782 /* MiniTabBar_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MiniTabBar_Example.app; sourceTree = BUILT_PRODUCTS_DIR; }; 607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 607FACD71AFB9204008FA782 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 607FACDA1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 607FACDC1AFB9204008FA782 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 607FACDF1AFB9204008FA782 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 607FACEA1AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 607FACEB1AFB9204008FA782 /* Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests.swift; sourceTree = ""; }; 6EC044A417FA9E39E9DF4137 /* MiniTabBar.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = MiniTabBar.podspec; path = ../MiniTabBar.podspec; sourceTree = ""; }; 78E60CA0E54EE68DFC6E197B /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 8ABE17B41217A06B3F492A90 /* Pods_MiniTabBar_Example.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MiniTabBar_Example.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8D1F9A1FFF068CA4F23C4B52 /* Pods-MiniTabBar_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MiniTabBar_Tests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MiniTabBar_Tests/Pods-MiniTabBar_Tests.debug.xcconfig"; sourceTree = ""; }; A0CF5ECA4EBFD9381CCECE8A /* Pods_MiniTabBar_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MiniTabBar_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; AC73F7929DFCC8773CB93543 /* Pods-MiniTabBar_Example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-MiniTabBar_Example.debug.xcconfig"; path = "Pods/Target Support Files/Pods-MiniTabBar_Example/Pods-MiniTabBar_Example.debug.xcconfig"; sourceTree = ""; }; B49045DAB621E94EA0D31840 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 607FACCD1AFB9204008FA782 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( 62B14762227F09369F1BF69B /* Pods_MiniTabBar_Example.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 607FACC71AFB9204008FA782 = { isa = PBXGroup; children = ( 607FACF51AFB993E008FA782 /* Podspec Metadata */, 607FACD21AFB9204008FA782 /* Example for MiniTabBar */, 607FACE81AFB9204008FA782 /* Tests */, 607FACD11AFB9204008FA782 /* Products */, C93675B9C97F7F912E39C06C /* Pods */, 93369F7EA7EEBC62AD07D879 /* Frameworks */, ); sourceTree = ""; }; 607FACD11AFB9204008FA782 /* Products */ = { isa = PBXGroup; children = ( 607FACD01AFB9204008FA782 /* MiniTabBar_Example.app */, ); name = Products; sourceTree = ""; }; 607FACD21AFB9204008FA782 /* Example for MiniTabBar */ = { isa = PBXGroup; children = ( 607FACD51AFB9204008FA782 /* AppDelegate.swift */, 607FACD71AFB9204008FA782 /* ViewController.swift */, 607FACD91AFB9204008FA782 /* Main.storyboard */, 607FACDC1AFB9204008FA782 /* Images.xcassets */, 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */, 607FACD31AFB9204008FA782 /* Supporting Files */, ); name = "Example for MiniTabBar"; path = MiniTabBar; sourceTree = ""; }; 607FACD31AFB9204008FA782 /* Supporting Files */ = { isa = PBXGroup; children = ( 607FACD41AFB9204008FA782 /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; 607FACE81AFB9204008FA782 /* Tests */ = { isa = PBXGroup; children = ( 607FACEB1AFB9204008FA782 /* Tests.swift */, 607FACE91AFB9204008FA782 /* Supporting Files */, ); path = Tests; sourceTree = ""; }; 607FACE91AFB9204008FA782 /* Supporting Files */ = { isa = PBXGroup; children = ( 607FACEA1AFB9204008FA782 /* Info.plist */, ); name = "Supporting Files"; sourceTree = ""; }; 607FACF51AFB993E008FA782 /* Podspec Metadata */ = { isa = PBXGroup; children = ( 6EC044A417FA9E39E9DF4137 /* MiniTabBar.podspec */, B49045DAB621E94EA0D31840 /* README.md */, 78E60CA0E54EE68DFC6E197B /* LICENSE */, ); name = "Podspec Metadata"; sourceTree = ""; }; 93369F7EA7EEBC62AD07D879 /* Frameworks */ = { isa = PBXGroup; children = ( 8ABE17B41217A06B3F492A90 /* Pods_MiniTabBar_Example.framework */, A0CF5ECA4EBFD9381CCECE8A /* Pods_MiniTabBar_Tests.framework */, ); name = Frameworks; sourceTree = ""; }; C93675B9C97F7F912E39C06C /* Pods */ = { isa = PBXGroup; children = ( AC73F7929DFCC8773CB93543 /* Pods-MiniTabBar_Example.debug.xcconfig */, 5977A86A2DB4E50719E1D312 /* Pods-MiniTabBar_Example.release.xcconfig */, 8D1F9A1FFF068CA4F23C4B52 /* Pods-MiniTabBar_Tests.debug.xcconfig */, 3E3B9FC0C368F181DFC0EA4C /* Pods-MiniTabBar_Tests.release.xcconfig */, ); name = Pods; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 607FACCF1AFB9204008FA782 /* MiniTabBar_Example */ = { isa = PBXNativeTarget; buildConfigurationList = 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "MiniTabBar_Example" */; buildPhases = ( D5810F6B0AFA93BB96FE5097 /* [CP] Check Pods Manifest.lock */, 607FACCC1AFB9204008FA782 /* Sources */, 607FACCD1AFB9204008FA782 /* Frameworks */, 607FACCE1AFB9204008FA782 /* Resources */, 7BF07501F2340EE56F3ADA98 /* [CP] Embed Pods Frameworks */, 1D091D49902CA735AF8E666C /* [CP] Copy Pods Resources */, ); buildRules = ( ); dependencies = ( ); name = MiniTabBar_Example; productName = MiniTabBar; productReference = 607FACD01AFB9204008FA782 /* MiniTabBar_Example.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 607FACC81AFB9204008FA782 /* Project object */ = { isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; LastUpgradeCheck = 0720; ORGANIZATIONNAME = CocoaPods; TargetAttributes = { 607FACCF1AFB9204008FA782 = { CreatedOnToolsVersion = 6.3.1; DevelopmentTeam = 5EFBK52YD3; LastSwiftMigration = 0820; }; }; }; buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "MiniTabBar" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 607FACC71AFB9204008FA782; productRefGroup = 607FACD11AFB9204008FA782 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 607FACCF1AFB9204008FA782 /* MiniTabBar_Example */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 607FACCE1AFB9204008FA782 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */, 607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */, 607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ 1D091D49902CA735AF8E666C /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "[CP] Copy Pods Resources"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MiniTabBar_Example/Pods-MiniTabBar_Example-resources.sh\"\n"; showEnvVarsInLog = 0; }; 7BF07501F2340EE56F3ADA98 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-MiniTabBar_Example/Pods-MiniTabBar_Example-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; D5810F6B0AFA93BB96FE5097 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( ); inputPaths = ( ); name = "[CP] Check Pods Manifest.lock"; outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 607FACCC1AFB9204008FA782 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 607FACD81AFB9204008FA782 /* ViewController.swift in Sources */, 607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 607FACD91AFB9204008FA782 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( 607FACDA1AFB9204008FA782 /* Base */, ); name = Main.storyboard; sourceTree = ""; }; 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */ = { isa = PBXVariantGroup; children = ( 607FACDF1AFB9204008FA782 /* Base */, ); name = LaunchScreen.xib; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 607FACED1AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; 607FACEE1AFB9204008FA782 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; CLANG_WARN_BOOL_CONVERSION = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; IPHONEOS_DEPLOYMENT_TARGET = 10.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; 607FACF01AFB9204008FA782 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = AC73F7929DFCC8773CB93543 /* Pods-MiniTabBar_Example.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 5EFBK52YD3; INFOPLIST_FILE = MiniTabBar/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; }; name = Debug; }; 607FACF11AFB9204008FA782 /* Release */ = { isa = XCBuildConfiguration; baseConfigurationReference = 5977A86A2DB4E50719E1D312 /* Pods-MiniTabBar_Example.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; DEVELOPMENT_TEAM = 5EFBK52YD3; INFOPLIST_FILE = MiniTabBar/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MODULE_NAME = ExampleApp; PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.demo.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 3.0; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "MiniTabBar" */ = { isa = XCConfigurationList; buildConfigurations = ( 607FACED1AFB9204008FA782 /* Debug */, 607FACEE1AFB9204008FA782 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 607FACEF1AFB9204008FA782 /* Build configuration list for PBXNativeTarget "MiniTabBar_Example" */ = { isa = XCConfigurationList; buildConfigurations = ( 607FACF01AFB9204008FA782 /* Debug */, 607FACF11AFB9204008FA782 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 607FACC81AFB9204008FA782 /* Project object */; } ================================================ FILE: Example/MiniTabBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Example/MiniTabBar.xcodeproj/xcshareddata/xcschemes/MiniTabBar-Example.xcscheme ================================================ ================================================ FILE: Example/MiniTabBar.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: Example/Podfile ================================================ use_frameworks! target 'MiniTabBar_Example' do pod 'MiniTabBar', :path => '../' target 'MiniTabBar_Tests' do inherit! :search_paths end end ================================================ FILE: Example/Tests/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType BNDL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 ================================================ FILE: Example/Tests/Tests.swift ================================================ import UIKit import XCTest import MiniTabBar class Tests: XCTestCase { override func setUp() { super.setUp() // Put setup code here. This method is called before the invocation of each test method in the class. } override func tearDown() { // Put teardown code here. This method is called after the invocation of each test method in the class. super.tearDown() } func testExample() { // This is an example of a functional test case. XCTAssert(true, "Pass") } func testPerformanceExample() { // This is an example of a performance test case. self.measure() { // Put the code you want to measure the time of here. } } } ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2017 Dylan Marriott Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: MiniTabBar/Assets/.gitkeep ================================================ ================================================ FILE: MiniTabBar/Classes/.gitkeep ================================================ ================================================ FILE: MiniTabBar/Classes/MiniTabBar.swift ================================================ // // MiniTabBar.swift // Pods // // Created by Dylan Marriott on 11/01/17. // // import Foundation import UIKit public class MiniTabBarItem { var title: String? var icon: UIImage? var customView: UIView? var offset = UIOffset.zero public var selectable: Bool = true public init(title: String, icon:UIImage) { self.title = title self.icon = icon } public init(customView: UIView, offset: UIOffset = UIOffset.zero) { self.customView = customView self.offset = offset } } public protocol MiniTabBarDelegate: class { func tabSelected(_ index: Int) } public class MiniTabBar: UIView { public weak var delegate: MiniTabBarDelegate? public let keyLine = UIView() public override var tintColor: UIColor! { didSet { for itv in self.itemViews { itv.tintColor = self.tintColor } } } public var font: UIFont? { didSet { for itv in self.itemViews { itv.font = self.font } } } private let visualEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .extraLight)) as UIVisualEffectView public var backgroundBlurEnabled: Bool = true { didSet { self.visualEffectView.isHidden = !self.backgroundBlurEnabled } } fileprivate var itemViews = [MiniTabBarItemView]() fileprivate var currentSelectedIndex: Int? fileprivate let bg = UIView() public init(items: [MiniTabBarItem]) { super.init(frame: CGRect.zero) bg.backgroundColor = UIColor(white: 1.0, alpha: 0.8) addSubview(bg) self.addSubview(visualEffectView) keyLine.backgroundColor = UIColor(white: 0.9, alpha: 1.0) self.addSubview(keyLine) var i = 0 for item in items { let itemView = MiniTabBarItemView(item) itemView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(MiniTabBar.itemTapped(_:)))) self.itemViews.append(itemView) self.addSubview(itemView) i += 1 } self.selectItem(0, animated: false) } required public init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } public override func layoutSubviews() { super.layoutSubviews() bg.frame = CGRect(x: 0, y: 0, width: self.frame.width, height: 1000) visualEffectView.frame = bg.bounds keyLine.frame = CGRect(x: 0, y: 0, width: self.frame.width, height: 1) let itemWidth = self.frame.width / CGFloat(self.itemViews.count) for (i, itemView) in self.itemViews.enumerated() { let x = itemWidth * CGFloat(i) itemView.frame = CGRect(x: x, y: 0, width: itemWidth, height: frame.size.height) } } @objc func itemTapped(_ gesture: UITapGestureRecognizer) { let itemView = gesture.view as! MiniTabBarItemView let selectedIndex = self.itemViews.index(of: itemView)! self.selectItem(selectedIndex) } public func selectItem(_ selectedIndex: Int, animated: Bool = true) { if !self.itemViews[selectedIndex].item.selectable { return } if (selectedIndex == self.currentSelectedIndex) { return } self.currentSelectedIndex = selectedIndex for (index, v) in self.itemViews.enumerated() { let selected = (index == selectedIndex) v.setSelected(selected, animated: animated) } self.delegate?.tabSelected(selectedIndex) } } ================================================ FILE: MiniTabBar/Classes/MiniTabBarItemView.swift ================================================ // // MiniTabBarItemView.swift // Pods // // Created by Dylan Marriott on 12/01/17. // // import Foundation import UIKit class MiniTabBarItemView: UIView { let item: MiniTabBarItem let titleLabel = UILabel() let iconView = UIImageView() private var selected = false override var tintColor: UIColor! { didSet { if self.selected { self.iconView.tintColor = self.tintColor } self.titleLabel.textColor = self.tintColor } } private let defaultFont = UIFont.systemFont(ofSize: 12) var font: UIFont? { didSet { self.titleLabel.font = self.font ?? defaultFont } } init(_ item: MiniTabBarItem) { self.item = item super.init(frame: CGRect.zero) if let customView = self.item.customView { assert(self.item.title == nil && self.item.icon == nil, "Don't set title / icon when using a custom view") assert(customView.frame.width > 0 && customView.frame.height > 0, "Custom view must have a width & height > 0") self.addSubview(customView) } else { assert(self.item.title != nil && self.item.icon != nil, "Title / Icon not set") if let title = self.item.title { titleLabel.text = title titleLabel.font = self.defaultFont titleLabel.textColor = self.tintColor titleLabel.textAlignment = .center titleLabel.alpha = 0.0 self.addSubview(titleLabel) } if let icon = self.item.icon { iconView.image = icon.withRenderingMode(.alwaysTemplate) self.addSubview(iconView) } } } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } override func layoutSubviews() { super.layoutSubviews() if let customView = self.item.customView { customView.center = CGPoint(x: self.frame.width / 2 + self.item.offset.horizontal, y: self.frame.height / 2 + self.item.offset.vertical) } else { titleLabel.frame = CGRect(x: 0, y: self.frame.height, width: self.frame.width, height: 14) iconView.frame = CGRect(x: self.frame.width / 2 - 13, y: 12, width: 26, height: 20) } } func setSelected(_ selected: Bool, animated: Bool = true) { self.selected = selected self.iconView.tintColor = selected ? self.tintColor : UIColor(white: 0.6, alpha: 1.0) if (animated && selected) { /* ICON */ UIView.animate(withDuration: 0.15, delay: 0, options: .curveEaseInOut, animations: { self.iconView.frame.origin.y = 5 }, completion: { finished in UIView.animate(withDuration: 0.4, delay: 0.5, options: UIViewAnimationOptions(), animations: { self.iconView.frame.origin.y = 12 }) }) /* TEXT */ UIView.animate(withDuration: 0.2, delay: 0, options: UIViewAnimationOptions(), animations: { self.titleLabel.frame.origin.y = 28 self.titleLabel.alpha = 1.0 }, completion: { finished in UIView.animate(withDuration: 0.2, delay: 0.5, options: UIViewAnimationOptions(), animations: { self.titleLabel.frame.origin.y = self.frame.size.height self.titleLabel.alpha = 0.0 }, completion: { finished in }) }) } } } ================================================ FILE: MiniTabBar.podspec ================================================ Pod::Spec.new do |s| s.name = 'MiniTabBar' s.version = '1.1.0' s.summary = 'Clean and simple UITabBar alternative' s.description = <<-DESC Written in Swift 3 this UITabBar alternative has a much cleaner look. Titles are only shown when tapped on. DESC s.homepage = 'https://github.com/d-32/MiniTabBar' s.screenshots = 'https://raw.githubusercontent.com/D-32/MiniTabBar/master/screenshot.png' s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'Dylan Marriott' => 'info@d-32.com' } s.source = { :git => 'https://github.com/d-32/MiniTabBar.git', :tag => s.version.to_s } s.social_media_url = 'https://twitter.com/dylan36032' s.ios.deployment_target = '10.0' s.source_files = 'MiniTabBar/Classes/**/*' end ================================================ FILE: README.md ================================================ [![Swift Version][swift-image]][swift-url] [![Version](https://img.shields.io/cocoapods/v/MiniTabBar.svg?style=flat)](http://cocoadocs.org/docsets/MiniTabBar) ![License](https://img.shields.io/cocoapods/l/MiniTabBar.svg?style=flat) [![twitter: @dylan36032](http://img.shields.io/badge/twitter-%40dylan36032-blue.svg?style=flat)](https://twitter.com/dylan36032) # MiniTabBar A clean simple alternative to the UITabBar. Only shows the title when being tapped on. Gives the app a way cleaner look :) ## Requirements - iOS 10.0+ - Xcode 8 ## Installation #### CocoaPods: You can use [CocoaPods](http://cocoapods.org/) to install `MiniTabBar` by adding it to your `Podfile`: ```ruby pod 'MiniTabBar' ``` #### Manually Drag and drop `MiniTabBar.swift` and `MiniTabBarItemView.swift` into your project. ## Usage ```swift // First create some tab bar items: // Icons should be a template image with the size 26 x 20 dp var items = [MiniTabBarItem]() items.append(MiniTabBarItem(title: "Tab Name", icon: )) //... // Create a MiniTabBar instance and add it as a regular subview: let tabBar = MiniTabBar(items: items) tabBar.translatesAutoresizingMaskIntoConstraints = false tabBar.delegate = self self.view.addSubview(tabBar) let constraints = [ tabBar.bottomAnchor.constraint(equalTo: view.layoutMarginsGuide.bottomAnchor), tabBar.widthAnchor.constraint(equalTo: view.widthAnchor), tabBar.heightAnchor.constraint(equalToConstant: 44), ] NSLayoutConstraint.activate(constraints) // Delegate protocol: func tabSelected(_ index: Int) { print("Selected tab: ", index) } ``` ## Costumization Here are some ways to customize the look of the MiniTabBar: ```swift // Change the tint colour of an item (title & icon): tabBar.tintColor = UIColor.red // Change the font of the title label: tabBar.font = UIFont.systemFont(ofSize: 10) // Select an item programmatically: tabBar.selectItem(2, animated: false) // Change the background & key line of the tab bar: tabBar.backgroundColor = UIColor.black tabBar.backgroundBlurEnabled = false tabBar.keyLine.isHidden = true ``` ### Custom View It's also possible to have a custom view that doesn't act like a tab. For example a (+) button in the middle. ```swift let customButton = UIButton() customButton.backgroundColor = UIColor.orange customButton.frame.size = CGSize(width: 50, height: 50) let customItem = MiniTabBarItem(customView: customButton, offset: UIOffset(horizontal: 0, vertical: -10)) customItem.selectable = false items.append(customItem) ``` [swift-image]:https://img.shields.io/badge/swift-3.0-orange.svg [swift-url]: https://swift.org/