diff --git a/MYTabBarDemo.xcodeproj/project.pbxproj b/MYTabBarDemo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..a8159da --- /dev/null +++ b/MYTabBarDemo.xcodeproj/project.pbxproj @@ -0,0 +1,371 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 50; + objects = { + +/* Begin PBXBuildFile section */ + 9F2B830B24558B3C00C384E1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2B830A24558B3C00C384E1 /* AppDelegate.swift */; }; + 9F2B830F24558B3C00C384E1 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2B830E24558B3C00C384E1 /* ViewController.swift */; }; + 9F2B831224558B3C00C384E1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F2B831024558B3C00C384E1 /* Main.storyboard */; }; + 9F2B831424558B4000C384E1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9F2B831324558B4000C384E1 /* Assets.xcassets */; }; + 9F2B831724558B4000C384E1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F2B831524558B4000C384E1 /* LaunchScreen.storyboard */; }; + 9F2B832024558F0700C384E1 /* Tab1ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2B831F24558F0700C384E1 /* Tab1ViewController.swift */; }; + 9F2B832324558F2A00C384E1 /* Tab3ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2B832124558F2A00C384E1 /* Tab3ViewController.swift */; }; + 9F2B832424558F2A00C384E1 /* Tab2ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9F2B832224558F2A00C384E1 /* Tab2ViewController.swift */; }; + 9F2B8327245593F600C384E1 /* tab1.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F2B8326245593F600C384E1 /* tab1.storyboard */; }; + 9F2B832A2455941400C384E1 /* tab3.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F2B83282455941400C384E1 /* tab3.storyboard */; }; + 9F2B832B2455941400C384E1 /* tab2.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9F2B83292455941400C384E1 /* tab2.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 9F2B830724558B3C00C384E1 /* MYTabBarDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MYTabBarDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 9F2B830A24558B3C00C384E1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 9F2B830E24558B3C00C384E1 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; + 9F2B831124558B3C00C384E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 9F2B831324558B4000C384E1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 9F2B831624558B4000C384E1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 9F2B831824558B4000C384E1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 9F2B831F24558F0700C384E1 /* Tab1ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tab1ViewController.swift; sourceTree = ""; }; + 9F2B832124558F2A00C384E1 /* Tab3ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tab3ViewController.swift; sourceTree = ""; }; + 9F2B832224558F2A00C384E1 /* Tab2ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Tab2ViewController.swift; sourceTree = ""; }; + 9F2B8326245593F600C384E1 /* tab1.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = tab1.storyboard; sourceTree = ""; }; + 9F2B83282455941400C384E1 /* tab3.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = tab3.storyboard; sourceTree = ""; }; + 9F2B83292455941400C384E1 /* tab2.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = tab2.storyboard; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 9F2B830424558B3C00C384E1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9F2B82FE24558B3C00C384E1 = { + isa = PBXGroup; + children = ( + 9F2B830924558B3C00C384E1 /* MYTabBarDemo */, + 9F2B830824558B3C00C384E1 /* Products */, + ); + sourceTree = ""; + }; + 9F2B830824558B3C00C384E1 /* Products */ = { + isa = PBXGroup; + children = ( + 9F2B830724558B3C00C384E1 /* MYTabBarDemo.app */, + ); + name = Products; + sourceTree = ""; + }; + 9F2B830924558B3C00C384E1 /* MYTabBarDemo */ = { + isa = PBXGroup; + children = ( + 9F2B830A24558B3C00C384E1 /* AppDelegate.swift */, + 9F2B830E24558B3C00C384E1 /* ViewController.swift */, + 9F2B831024558B3C00C384E1 /* Main.storyboard */, + 9F2B831324558B4000C384E1 /* Assets.xcassets */, + 9F2B831524558B4000C384E1 /* LaunchScreen.storyboard */, + 9F2B831824558B4000C384E1 /* Info.plist */, + 9F2B831E24558E1400C384E1 /* ViewControllers */, + ); + path = MYTabBarDemo; + sourceTree = ""; + }; + 9F2B831E24558E1400C384E1 /* ViewControllers */ = { + isa = PBXGroup; + children = ( + 9F2B8326245593F600C384E1 /* tab1.storyboard */, + 9F2B83292455941400C384E1 /* tab2.storyboard */, + 9F2B83282455941400C384E1 /* tab3.storyboard */, + 9F2B831F24558F0700C384E1 /* Tab1ViewController.swift */, + 9F2B832224558F2A00C384E1 /* Tab2ViewController.swift */, + 9F2B832124558F2A00C384E1 /* Tab3ViewController.swift */, + ); + path = ViewControllers; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 9F2B830624558B3C00C384E1 /* MYTabBarDemo */ = { + isa = PBXNativeTarget; + buildConfigurationList = 9F2B831B24558B4000C384E1 /* Build configuration list for PBXNativeTarget "MYTabBarDemo" */; + buildPhases = ( + 9F2B830324558B3C00C384E1 /* Sources */, + 9F2B830424558B3C00C384E1 /* Frameworks */, + 9F2B830524558B3C00C384E1 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MYTabBarDemo; + productName = MYTabBarDemo; + productReference = 9F2B830724558B3C00C384E1 /* MYTabBarDemo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 9F2B82FF24558B3C00C384E1 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 1110; + LastUpgradeCheck = 1110; + ORGANIZATIONNAME = "Abhishek Thapliyal"; + TargetAttributes = { + 9F2B830624558B3C00C384E1 = { + CreatedOnToolsVersion = 11.1; + }; + }; + }; + buildConfigurationList = 9F2B830224558B3C00C384E1 /* Build configuration list for PBXProject "MYTabBarDemo" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 9F2B82FE24558B3C00C384E1; + productRefGroup = 9F2B830824558B3C00C384E1 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 9F2B830624558B3C00C384E1 /* MYTabBarDemo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 9F2B830524558B3C00C384E1 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9F2B831724558B4000C384E1 /* LaunchScreen.storyboard in Resources */, + 9F2B832B2455941400C384E1 /* tab2.storyboard in Resources */, + 9F2B831424558B4000C384E1 /* Assets.xcassets in Resources */, + 9F2B8327245593F600C384E1 /* tab1.storyboard in Resources */, + 9F2B831224558B3C00C384E1 /* Main.storyboard in Resources */, + 9F2B832A2455941400C384E1 /* tab3.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 9F2B830324558B3C00C384E1 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 9F2B832324558F2A00C384E1 /* Tab3ViewController.swift in Sources */, + 9F2B832024558F0700C384E1 /* Tab1ViewController.swift in Sources */, + 9F2B830F24558B3C00C384E1 /* ViewController.swift in Sources */, + 9F2B832424558F2A00C384E1 /* Tab2ViewController.swift in Sources */, + 9F2B830B24558B3C00C384E1 /* AppDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 9F2B831024558B3C00C384E1 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9F2B831124558B3C00C384E1 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 9F2B831524558B4000C384E1 /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 9F2B831624558B4000C384E1 /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 9F2B831924558B4000C384E1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + 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 = 13.1; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 9F2B831A24558B4000C384E1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + 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 = 13.1; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 9F2B831C24558B4000C384E1 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 2P7R4H9ZM8; + INFOPLIST_FILE = MYTabBarDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.nickelfox.MYTabBarDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 9F2B831D24558B4000C384E1 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 2P7R4H9ZM8; + INFOPLIST_FILE = MYTabBarDemo/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.nickelfox.MYTabBarDemo; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 9F2B830224558B3C00C384E1 /* Build configuration list for PBXProject "MYTabBarDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9F2B831924558B4000C384E1 /* Debug */, + 9F2B831A24558B4000C384E1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 9F2B831B24558B4000C384E1 /* Build configuration list for PBXNativeTarget "MYTabBarDemo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 9F2B831C24558B4000C384E1 /* Debug */, + 9F2B831D24558B4000C384E1 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 9F2B82FF24558B3C00C384E1 /* Project object */; +} diff --git a/MYTabBarDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/MYTabBarDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..3dd52ba --- /dev/null +++ b/MYTabBarDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/MYTabBarDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/MYTabBarDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/MYTabBarDemo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/MYTabBarDemo/AppDelegate.swift b/MYTabBarDemo/AppDelegate.swift new file mode 100644 index 0000000..012a5ca --- /dev/null +++ b/MYTabBarDemo/AppDelegate.swift @@ -0,0 +1,24 @@ +// +// AppDelegate.swift +// MYTabBarDemo +// +// Created by Abhishek Thapliyal on 26/04/20. +// Copyright © 2020 Abhishek Thapliyal. All rights reserved. +// + +import UIKit + +@UIApplicationMain +class AppDelegate: UIResponder, UIApplicationDelegate { + + var window: UIWindow? + + func application(_ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + // Override point for customization after application launch. + return true + } + + +} + diff --git a/MYTabBarDemo/Assets.xcassets/AppIcon.appiconset/Contents.json b/MYTabBarDemo/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d8db8d6 --- /dev/null +++ b/MYTabBarDemo/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,98 @@ +{ + "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" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "83.5x83.5", + "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MYTabBarDemo/Assets.xcassets/Contents.json b/MYTabBarDemo/Assets.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/MYTabBarDemo/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/MYTabBarDemo/Base.lproj/LaunchScreen.storyboard b/MYTabBarDemo/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..865e932 --- /dev/null +++ b/MYTabBarDemo/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MYTabBarDemo/Base.lproj/Main.storyboard b/MYTabBarDemo/Base.lproj/Main.storyboard new file mode 100644 index 0000000..8897987 --- /dev/null +++ b/MYTabBarDemo/Base.lproj/Main.storyboard @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MYTabBarDemo/Info.plist b/MYTabBarDemo/Info.plist new file mode 100644 index 0000000..af8868b --- /dev/null +++ b/MYTabBarDemo/Info.plist @@ -0,0 +1,45 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/MYTabBarDemo/ViewController.swift b/MYTabBarDemo/ViewController.swift new file mode 100644 index 0000000..c8836a7 --- /dev/null +++ b/MYTabBarDemo/ViewController.swift @@ -0,0 +1,72 @@ +// +// ViewController.swift +// MYTabBarDemo +// +// Created by Abhishek Thapliyal on 26/04/20. +// Copyright © 2020 Abhishek Thapliyal. All rights reserved. +// + +import UIKit + +class ViewController: UIViewController { + + @IBOutlet weak var containerView: UIView! + + // control + drag all tab buttons to this + // it will give array of buttons + @IBOutlet var buttons: [UIButton]! + + var tab1VC = Tab1ViewController.newInstance + var tab2VC = Tab2ViewController.newInstance + var tab3VC = Tab3ViewController.newInstance + + lazy var viewControllers: [UIViewController] = { + return [self.tab1VC, self.tab2VC, self.tab3VC] + }() + + var selectedIndex: Int = 0 + + override func viewDidLoad() { + super.viewDidLoad() + + // set intial state + let button = self.buttons[selectedIndex] +// self.buttons[selectedIndex].isSelected = true + button.isSelected = true + self.handleTap(button: button) + } + + @IBAction func didPressTabButton(_ sender: UIButton) { + self.handleTap(button: sender) + } + +} + +// MARK: button 1 actions + +extension ViewController { + + private func handleTap(button: UIButton) { + let previousIndex = self.selectedIndex + + // reset previous selected button state + self.buttons[previousIndex].isSelected = false + + // remove previous view + let previousVC = self.viewControllers[previousIndex] + previousVC.willMove(toParent: nil) + previousVC.view.removeFromSuperview() + previousVC.removeFromParent() + + + self.selectedIndex = button.tag + button.isSelected = true + let vc = viewControllers[self.selectedIndex] + self.addChild(vc) + vc.view.frame = self.containerView.bounds + self.containerView.addSubview(vc.view) + vc.didMove(toParent: self) + } + +} + diff --git a/MYTabBarDemo/ViewControllers/Tab1ViewController.swift b/MYTabBarDemo/ViewControllers/Tab1ViewController.swift new file mode 100644 index 0000000..ef8ecde --- /dev/null +++ b/MYTabBarDemo/ViewControllers/Tab1ViewController.swift @@ -0,0 +1,38 @@ +// +// Tab1ViewController.swift +// MYTabBarDemo +// +// Created by Abhishek Thapliyal on 26/04/20. +// Copyright © 2020 Abhishek Thapliyal. All rights reserved. +// + +import UIKit + +class Tab1ViewController: UIViewController { + + static var newInstance: Tab1ViewController { + let storyboard = UIStoryboard(name: "tab1", bundle: nil) + let vc = storyboard.instantiateViewController( + withIdentifier: "Tab1ViewController" + ) as! Tab1ViewController + return vc + } + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/MYTabBarDemo/ViewControllers/Tab2ViewController.swift b/MYTabBarDemo/ViewControllers/Tab2ViewController.swift new file mode 100644 index 0000000..2f555c7 --- /dev/null +++ b/MYTabBarDemo/ViewControllers/Tab2ViewController.swift @@ -0,0 +1,38 @@ +// +// Tab1ViewController.swift +// MYTabBarDemo +// +// Created by Abhishek Thapliyal on 26/04/20. +// Copyright © 2020 Abhishek Thapliyal. All rights reserved. +// + +import UIKit + +class Tab2ViewController: UIViewController { + + static var newInstance: Tab2ViewController { + let storyboard = UIStoryboard(name: "tab2", bundle: nil) + let vc = storyboard.instantiateViewController( + withIdentifier: "Tab2ViewController" + ) as! Tab2ViewController + return vc + } + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/MYTabBarDemo/ViewControllers/Tab3ViewController.swift b/MYTabBarDemo/ViewControllers/Tab3ViewController.swift new file mode 100644 index 0000000..c4292fb --- /dev/null +++ b/MYTabBarDemo/ViewControllers/Tab3ViewController.swift @@ -0,0 +1,38 @@ +// +// Tab1ViewController.swift +// MYTabBarDemo +// +// Created by Abhishek Thapliyal on 26/04/20. +// Copyright © 2020 Abhishek Thapliyal. All rights reserved. +// + +import UIKit + +class Tab3ViewController: UIViewController { + + static var newInstance: Tab3ViewController { + let storyboard = UIStoryboard(name: "tab3", bundle: nil) + let vc = storyboard.instantiateViewController( + withIdentifier: "Tab3ViewController" + ) as! Tab3ViewController + return vc + } + + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/MYTabBarDemo/ViewControllers/tab1.storyboard b/MYTabBarDemo/ViewControllers/tab1.storyboard new file mode 100644 index 0000000..16e597c --- /dev/null +++ b/MYTabBarDemo/ViewControllers/tab1.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MYTabBarDemo/ViewControllers/tab2.storyboard b/MYTabBarDemo/ViewControllers/tab2.storyboard new file mode 100644 index 0000000..c3f5b18 --- /dev/null +++ b/MYTabBarDemo/ViewControllers/tab2.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MYTabBarDemo/ViewControllers/tab3.storyboard b/MYTabBarDemo/ViewControllers/tab3.storyboard new file mode 100644 index 0000000..3bdae7a --- /dev/null +++ b/MYTabBarDemo/ViewControllers/tab3.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +