├── DGSegmentedControl.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcuserdata │ │ └── dip.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── apple.xcuserdatad │ └── xcschemes │ │ ├── DGSegmentedControl.xcscheme │ │ └── xcschememanagement.plist │ ├── dip-mport.xcuserdatad │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ │ └── xcschememanagement.plist │ └── dip.xcuserdatad │ └── xcschemes │ ├── DGSegmentedControl.xcscheme │ └── xcschememanagement.plist ├── DGSegmentedControl ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── DGSegmentedControl │ └── DGSegmentedControl.swift ├── Info.plist └── ViewController.swift ├── Licence.md └── README.md /DGSegmentedControl.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 18DE8F8F1C7466A10099F63D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18DE8F8E1C7466A10099F63D /* AppDelegate.swift */; }; 11 | 18DE8F911C7466A10099F63D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18DE8F901C7466A10099F63D /* ViewController.swift */; }; 12 | 18DE8F941C7466A10099F63D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18DE8F921C7466A10099F63D /* Main.storyboard */; }; 13 | 18DE8F971C7466A10099F63D /* DGSegmentedControl.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = 18DE8F951C7466A10099F63D /* DGSegmentedControl.xcdatamodeld */; }; 14 | 18DE8F991C7466A10099F63D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 18DE8F981C7466A10099F63D /* Assets.xcassets */; }; 15 | 18DE8F9C1C7466A10099F63D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 18DE8F9A1C7466A10099F63D /* LaunchScreen.storyboard */; }; 16 | 18DE8FC11C7467E80099F63D /* DGSegmentedControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18DE8FC01C7467E80099F63D /* DGSegmentedControl.swift */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXFileReference section */ 20 | 18DE8F8B1C7466A00099F63D /* DGSegmentedControl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DGSegmentedControl.app; sourceTree = BUILT_PRODUCTS_DIR; }; 21 | 18DE8F8E1C7466A10099F63D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 22 | 18DE8F901C7466A10099F63D /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 23 | 18DE8F931C7466A10099F63D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 24 | 18DE8F961C7466A10099F63D /* DGSegmentedControl.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = DGSegmentedControl.xcdatamodel; sourceTree = ""; }; 25 | 18DE8F981C7466A10099F63D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | 18DE8F9B1C7466A10099F63D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | 18DE8F9D1C7466A10099F63D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | 18DE8FC01C7467E80099F63D /* DGSegmentedControl.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DGSegmentedControl.swift; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | 18DE8F881C7466A00099F63D /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | ); 37 | runOnlyForDeploymentPostprocessing = 0; 38 | }; 39 | /* End PBXFrameworksBuildPhase section */ 40 | 41 | /* Begin PBXGroup section */ 42 | 18DE8F821C7466A00099F63D = { 43 | isa = PBXGroup; 44 | children = ( 45 | 18DE8F8D1C7466A10099F63D /* DGSegmentedControl */, 46 | 18DE8F8C1C7466A00099F63D /* Products */, 47 | ); 48 | sourceTree = ""; 49 | }; 50 | 18DE8F8C1C7466A00099F63D /* Products */ = { 51 | isa = PBXGroup; 52 | children = ( 53 | 18DE8F8B1C7466A00099F63D /* DGSegmentedControl.app */, 54 | ); 55 | name = Products; 56 | sourceTree = ""; 57 | }; 58 | 18DE8F8D1C7466A10099F63D /* DGSegmentedControl */ = { 59 | isa = PBXGroup; 60 | children = ( 61 | 18DE8FBF1C7467E80099F63D /* DGSegmentedControl */, 62 | 18DE8F8E1C7466A10099F63D /* AppDelegate.swift */, 63 | 18DE8F901C7466A10099F63D /* ViewController.swift */, 64 | 18DE8F921C7466A10099F63D /* Main.storyboard */, 65 | 18DE8F981C7466A10099F63D /* Assets.xcassets */, 66 | 18DE8F9A1C7466A10099F63D /* LaunchScreen.storyboard */, 67 | 18DE8F9D1C7466A10099F63D /* Info.plist */, 68 | 18DE8F951C7466A10099F63D /* DGSegmentedControl.xcdatamodeld */, 69 | ); 70 | path = DGSegmentedControl; 71 | sourceTree = ""; 72 | }; 73 | 18DE8FBF1C7467E80099F63D /* DGSegmentedControl */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 18DE8FC01C7467E80099F63D /* DGSegmentedControl.swift */, 77 | ); 78 | path = DGSegmentedControl; 79 | sourceTree = ""; 80 | }; 81 | /* End PBXGroup section */ 82 | 83 | /* Begin PBXNativeTarget section */ 84 | 18DE8F8A1C7466A00099F63D /* DGSegmentedControl */ = { 85 | isa = PBXNativeTarget; 86 | buildConfigurationList = 18DE8FB61C7466A10099F63D /* Build configuration list for PBXNativeTarget "DGSegmentedControl" */; 87 | buildPhases = ( 88 | 18DE8F871C7466A00099F63D /* Sources */, 89 | 18DE8F881C7466A00099F63D /* Frameworks */, 90 | 18DE8F891C7466A00099F63D /* Resources */, 91 | ); 92 | buildRules = ( 93 | ); 94 | dependencies = ( 95 | ); 96 | name = DGSegmentedControl; 97 | productName = DGSegmentedControl; 98 | productReference = 18DE8F8B1C7466A00099F63D /* DGSegmentedControl.app */; 99 | productType = "com.apple.product-type.application"; 100 | }; 101 | /* End PBXNativeTarget section */ 102 | 103 | /* Begin PBXProject section */ 104 | 18DE8F831C7466A00099F63D /* Project object */ = { 105 | isa = PBXProject; 106 | attributes = { 107 | LastSwiftUpdateCheck = 0720; 108 | LastUpgradeCheck = 0800; 109 | ORGANIZATIONNAME = apple; 110 | TargetAttributes = { 111 | 18DE8F8A1C7466A00099F63D = { 112 | CreatedOnToolsVersion = 7.2; 113 | LastSwiftMigration = 0800; 114 | }; 115 | }; 116 | }; 117 | buildConfigurationList = 18DE8F861C7466A00099F63D /* Build configuration list for PBXProject "DGSegmentedControl" */; 118 | compatibilityVersion = "Xcode 3.2"; 119 | developmentRegion = English; 120 | hasScannedForEncodings = 0; 121 | knownRegions = ( 122 | en, 123 | Base, 124 | ); 125 | mainGroup = 18DE8F821C7466A00099F63D; 126 | productRefGroup = 18DE8F8C1C7466A00099F63D /* Products */; 127 | projectDirPath = ""; 128 | projectRoot = ""; 129 | targets = ( 130 | 18DE8F8A1C7466A00099F63D /* DGSegmentedControl */, 131 | ); 132 | }; 133 | /* End PBXProject section */ 134 | 135 | /* Begin PBXResourcesBuildPhase section */ 136 | 18DE8F891C7466A00099F63D /* Resources */ = { 137 | isa = PBXResourcesBuildPhase; 138 | buildActionMask = 2147483647; 139 | files = ( 140 | 18DE8F9C1C7466A10099F63D /* LaunchScreen.storyboard in Resources */, 141 | 18DE8F991C7466A10099F63D /* Assets.xcassets in Resources */, 142 | 18DE8F941C7466A10099F63D /* Main.storyboard in Resources */, 143 | ); 144 | runOnlyForDeploymentPostprocessing = 0; 145 | }; 146 | /* End PBXResourcesBuildPhase section */ 147 | 148 | /* Begin PBXSourcesBuildPhase section */ 149 | 18DE8F871C7466A00099F63D /* Sources */ = { 150 | isa = PBXSourcesBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | 18DE8F911C7466A10099F63D /* ViewController.swift in Sources */, 154 | 18DE8F8F1C7466A10099F63D /* AppDelegate.swift in Sources */, 155 | 18DE8F971C7466A10099F63D /* DGSegmentedControl.xcdatamodeld in Sources */, 156 | 18DE8FC11C7467E80099F63D /* DGSegmentedControl.swift in Sources */, 157 | ); 158 | runOnlyForDeploymentPostprocessing = 0; 159 | }; 160 | /* End PBXSourcesBuildPhase section */ 161 | 162 | /* Begin PBXVariantGroup section */ 163 | 18DE8F921C7466A10099F63D /* Main.storyboard */ = { 164 | isa = PBXVariantGroup; 165 | children = ( 166 | 18DE8F931C7466A10099F63D /* Base */, 167 | ); 168 | name = Main.storyboard; 169 | sourceTree = ""; 170 | }; 171 | 18DE8F9A1C7466A10099F63D /* LaunchScreen.storyboard */ = { 172 | isa = PBXVariantGroup; 173 | children = ( 174 | 18DE8F9B1C7466A10099F63D /* Base */, 175 | ); 176 | name = LaunchScreen.storyboard; 177 | sourceTree = ""; 178 | }; 179 | /* End PBXVariantGroup section */ 180 | 181 | /* Begin XCBuildConfiguration section */ 182 | 18DE8FB41C7466A10099F63D /* Debug */ = { 183 | isa = XCBuildConfiguration; 184 | buildSettings = { 185 | ALWAYS_SEARCH_USER_PATHS = NO; 186 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 187 | CLANG_CXX_LIBRARY = "libc++"; 188 | CLANG_ENABLE_MODULES = YES; 189 | CLANG_ENABLE_OBJC_ARC = YES; 190 | CLANG_WARN_BOOL_CONVERSION = YES; 191 | CLANG_WARN_CONSTANT_CONVERSION = YES; 192 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 193 | CLANG_WARN_EMPTY_BODY = YES; 194 | CLANG_WARN_ENUM_CONVERSION = YES; 195 | CLANG_WARN_INFINITE_RECURSION = YES; 196 | CLANG_WARN_INT_CONVERSION = YES; 197 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 198 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 199 | CLANG_WARN_UNREACHABLE_CODE = YES; 200 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 201 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 202 | COPY_PHASE_STRIP = NO; 203 | DEBUG_INFORMATION_FORMAT = dwarf; 204 | ENABLE_STRICT_OBJC_MSGSEND = YES; 205 | ENABLE_TESTABILITY = YES; 206 | GCC_C_LANGUAGE_STANDARD = gnu99; 207 | GCC_DYNAMIC_NO_PIC = NO; 208 | GCC_NO_COMMON_BLOCKS = YES; 209 | GCC_OPTIMIZATION_LEVEL = 0; 210 | GCC_PREPROCESSOR_DEFINITIONS = ( 211 | "DEBUG=1", 212 | "$(inherited)", 213 | ); 214 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 215 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 216 | GCC_WARN_UNDECLARED_SELECTOR = YES; 217 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 218 | GCC_WARN_UNUSED_FUNCTION = YES; 219 | GCC_WARN_UNUSED_VARIABLE = YES; 220 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 221 | MTL_ENABLE_DEBUG_INFO = YES; 222 | ONLY_ACTIVE_ARCH = YES; 223 | SDKROOT = iphoneos; 224 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 225 | SWIFT_VERSION = 4.2; 226 | TARGETED_DEVICE_FAMILY = "1,2"; 227 | }; 228 | name = Debug; 229 | }; 230 | 18DE8FB51C7466A10099F63D /* Release */ = { 231 | isa = XCBuildConfiguration; 232 | buildSettings = { 233 | ALWAYS_SEARCH_USER_PATHS = NO; 234 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 235 | CLANG_CXX_LIBRARY = "libc++"; 236 | CLANG_ENABLE_MODULES = YES; 237 | CLANG_ENABLE_OBJC_ARC = YES; 238 | CLANG_WARN_BOOL_CONVERSION = YES; 239 | CLANG_WARN_CONSTANT_CONVERSION = YES; 240 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 241 | CLANG_WARN_EMPTY_BODY = YES; 242 | CLANG_WARN_ENUM_CONVERSION = YES; 243 | CLANG_WARN_INFINITE_RECURSION = YES; 244 | CLANG_WARN_INT_CONVERSION = YES; 245 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 246 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 247 | CLANG_WARN_UNREACHABLE_CODE = YES; 248 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 249 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 250 | COPY_PHASE_STRIP = NO; 251 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 252 | ENABLE_NS_ASSERTIONS = NO; 253 | ENABLE_STRICT_OBJC_MSGSEND = YES; 254 | GCC_C_LANGUAGE_STANDARD = gnu99; 255 | GCC_NO_COMMON_BLOCKS = YES; 256 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 257 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 258 | GCC_WARN_UNDECLARED_SELECTOR = YES; 259 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 260 | GCC_WARN_UNUSED_FUNCTION = YES; 261 | GCC_WARN_UNUSED_VARIABLE = YES; 262 | IPHONEOS_DEPLOYMENT_TARGET = 9.2; 263 | MTL_ENABLE_DEBUG_INFO = NO; 264 | SDKROOT = iphoneos; 265 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 266 | SWIFT_VERSION = 4.2; 267 | TARGETED_DEVICE_FAMILY = "1,2"; 268 | VALIDATE_PRODUCT = YES; 269 | }; 270 | name = Release; 271 | }; 272 | 18DE8FB71C7466A10099F63D /* Debug */ = { 273 | isa = XCBuildConfiguration; 274 | buildSettings = { 275 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 276 | INFOPLIST_FILE = DGSegmentedControl/Info.plist; 277 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 278 | PRODUCT_BUNDLE_IDENTIFIER = com.esignature.www.DGSegmentedControl; 279 | PRODUCT_NAME = "$(TARGET_NAME)"; 280 | SWIFT_VERSION = 4.2; 281 | }; 282 | name = Debug; 283 | }; 284 | 18DE8FB81C7466A10099F63D /* Release */ = { 285 | isa = XCBuildConfiguration; 286 | buildSettings = { 287 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 288 | INFOPLIST_FILE = DGSegmentedControl/Info.plist; 289 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 290 | PRODUCT_BUNDLE_IDENTIFIER = com.esignature.www.DGSegmentedControl; 291 | PRODUCT_NAME = "$(TARGET_NAME)"; 292 | SWIFT_VERSION = 4.2; 293 | }; 294 | name = Release; 295 | }; 296 | /* End XCBuildConfiguration section */ 297 | 298 | /* Begin XCConfigurationList section */ 299 | 18DE8F861C7466A00099F63D /* Build configuration list for PBXProject "DGSegmentedControl" */ = { 300 | isa = XCConfigurationList; 301 | buildConfigurations = ( 302 | 18DE8FB41C7466A10099F63D /* Debug */, 303 | 18DE8FB51C7466A10099F63D /* Release */, 304 | ); 305 | defaultConfigurationIsVisible = 0; 306 | defaultConfigurationName = Release; 307 | }; 308 | 18DE8FB61C7466A10099F63D /* Build configuration list for PBXNativeTarget "DGSegmentedControl" */ = { 309 | isa = XCConfigurationList; 310 | buildConfigurations = ( 311 | 18DE8FB71C7466A10099F63D /* Debug */, 312 | 18DE8FB81C7466A10099F63D /* Release */, 313 | ); 314 | defaultConfigurationIsVisible = 0; 315 | defaultConfigurationName = Release; 316 | }; 317 | /* End XCConfigurationList section */ 318 | 319 | /* Begin XCVersionGroup section */ 320 | 18DE8F951C7466A10099F63D /* DGSegmentedControl.xcdatamodeld */ = { 321 | isa = XCVersionGroup; 322 | children = ( 323 | 18DE8F961C7466A10099F63D /* DGSegmentedControl.xcdatamodel */, 324 | ); 325 | currentVersion = 18DE8F961C7466A10099F63D /* DGSegmentedControl.xcdatamodel */; 326 | path = DGSegmentedControl.xcdatamodeld; 327 | sourceTree = ""; 328 | versionGroupType = wrapper.xcdatamodel; 329 | }; 330 | /* End XCVersionGroup section */ 331 | }; 332 | rootObject = 18DE8F831C7466A00099F63D /* Project object */; 333 | } 334 | -------------------------------------------------------------------------------- /DGSegmentedControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DGSegmentedControl.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DGSegmentedControl.xcodeproj/project.xcworkspace/xcuserdata/dip.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dipkasyap/DGSegmentedControl/275b82cde5dd08eb073c8fbcc50b2551b58c9abc/DGSegmentedControl.xcodeproj/project.xcworkspace/xcuserdata/dip.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DGSegmentedControl.xcodeproj/xcuserdata/apple.xcuserdatad/xcschemes/DGSegmentedControl.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /DGSegmentedControl.xcodeproj/xcuserdata/apple.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DGSegmentedControl.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 18DE8F8A1C7466A00099F63D 16 | 17 | primary 18 | 19 | 20 | 18DE8FA11C7466A10099F63D 21 | 22 | primary 23 | 24 | 25 | 18DE8FAC1C7466A10099F63D 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /DGSegmentedControl.xcodeproj/xcuserdata/dip-mport.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /DGSegmentedControl.xcodeproj/xcuserdata/dip-mport.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DGSegmentedControl.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DGSegmentedControl.xcodeproj/xcuserdata/dip.xcuserdatad/xcschemes/DGSegmentedControl.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 43 | 49 | 50 | 51 | 52 | 53 | 59 | 60 | 61 | 62 | 63 | 64 | 74 | 76 | 82 | 83 | 84 | 85 | 86 | 87 | 93 | 95 | 101 | 102 | 103 | 104 | 106 | 107 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /DGSegmentedControl.xcodeproj/xcuserdata/dip.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DGSegmentedControl.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 18DE8F8A1C7466A00099F63D 16 | 17 | primary 18 | 19 | 20 | 18DE8FA11C7466A10099F63D 21 | 22 | primary 23 | 24 | 25 | 18DE8FAC1C7466A10099F63D 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /DGSegmentedControl/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | /****************************************************************************************************************** 2 | The MIT License (MIT) Copyright (c) 2014 Dip Kasyap (Devi Prasad Ghimire) 3 | 4 | email:- dpd.ghimire@gmail.com github : https://github.com/dipkasyap/DGSegmentedControl 5 | 6 | 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. 7 | 8 | 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 DGLocalization 9 | ******************************************************************************************************************/ 10 | 11 | 12 | import UIKit 13 | import CoreData 14 | 15 | @UIApplicationMain 16 | class AppDelegate: UIResponder, UIApplicationDelegate { 17 | 18 | var window: UIWindow? 19 | 20 | 21 | func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { 22 | // Override point for customization after application launch. 23 | return true 24 | } 25 | 26 | func applicationWillResignActive(application: UIApplication) { 27 | // 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. 28 | // 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. 29 | } 30 | 31 | func applicationDidEnterBackground(application: UIApplication) { 32 | // 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. 33 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 34 | } 35 | 36 | func applicationWillEnterForeground(application: UIApplication) { 37 | // 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. 38 | } 39 | 40 | func applicationDidBecomeActive(application: UIApplication) { 41 | // 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. 42 | } 43 | 44 | func applicationWillTerminate(application: UIApplication) { 45 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 46 | // Saves changes in the application's managed object context before the application terminates. 47 | } 48 | 49 | } 50 | 51 | -------------------------------------------------------------------------------- /DGSegmentedControl/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 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /DGSegmentedControl/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 | 27 | 28 | -------------------------------------------------------------------------------- /DGSegmentedControl/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 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /DGSegmentedControl/DGSegmentedControl/DGSegmentedControl.swift: -------------------------------------------------------------------------------- 1 | /****************************************************************************************************************** 2 | The MIT License (MIT) Copyright (c) 2014 Dip Kasyap (Devi Prasad Ghimire) 3 | 4 | email:- dpd.ghimire@gmail.com github : https://github.com/dipkasyap/DGSegmentedControl 5 | 6 | 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. 7 | 8 | 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 DGLocalization 9 | ******************************************************************************************************************/ 10 | 11 | import UIKit 12 | 13 | @IBDesignable class DGSegmentedControl: UIControl { 14 | 15 | private var labels = [UILabel]() 16 | 17 | var thumbView = UIView() 18 | var underLine = UIView() 19 | 20 | var items: [String] = ["Item 1", "Item 2"] { 21 | didSet { 22 | setupLabels() 23 | } 24 | } 25 | 26 | var selectedIndex : Int = 0 { 27 | didSet { 28 | displayNewSelectedIndex() 29 | } 30 | } 31 | 32 | @IBInspectable var selectedLabelColor : UIColor = UIColor.white { 33 | didSet { 34 | setSelectedColors() 35 | } 36 | } 37 | 38 | @IBInspectable var unselectedLabelColor : UIColor = UIColor.black { 39 | didSet { 40 | setSelectedColors() 41 | } 42 | } 43 | 44 | @IBInspectable var thumbColor : UIColor = UIColor(red: 0.961, green: 0.831, blue: 0.243, alpha: 1.00) { 45 | didSet { 46 | setSelectedColors() 47 | } 48 | } 49 | 50 | @IBInspectable var tabBorderColor : UIColor = UIColor(red: 0.788, green: 0.788, blue: 0.788, alpha: 1.00) { 51 | didSet { 52 | setNeedsDisplay() 53 | } 54 | } 55 | 56 | @IBInspectable var font: UIFont! = UIFont.systemFont(ofSize: 12) { 57 | didSet { 58 | setFont() 59 | } 60 | } 61 | 62 | @IBInspectable var borderSize: CGFloat = 0.5 { 63 | didSet { 64 | setNeedsDisplay() 65 | } 66 | } 67 | 68 | @IBInspectable var thumUnderLineSize:CGFloat = 4 { 69 | didSet { 70 | layoutSubviews() 71 | } 72 | } 73 | 74 | //MARK:- init 75 | override init(frame: CGRect) { 76 | super.init(frame: frame) 77 | setupView() 78 | } 79 | 80 | required init(coder: NSCoder) { 81 | super.init(coder: coder)! 82 | setupView() 83 | } 84 | 85 | override func draw(_ rect: CGRect) { 86 | super.draw(rect) 87 | setBorder() 88 | } 89 | 90 | override func layoutSubviews() { 91 | super.layoutSubviews() 92 | setupThumb() 93 | displayNewSelectedIndex() 94 | } 95 | 96 | 97 | //MARK:- setup 98 | func setupView(){ 99 | setupLabels() 100 | addIndividualItemConstraints(items: labels, mainView: self, padding: 0) 101 | insertSubview(thumbView, at: 0) 102 | } 103 | 104 | private func setupThumb() { 105 | var thumbFrame = self.bounds 106 | let newWidth = thumbFrame.width / CGFloat(items.count) 107 | thumbFrame.size.width = newWidth 108 | thumbFrame.origin.y = thumbFrame.height - self.thumUnderLineSize 109 | thumbFrame.size.height = thumUnderLineSize 110 | thumbView.frame = thumbFrame 111 | thumbView.backgroundColor = thumbColor 112 | } 113 | 114 | func setBorder(){ 115 | self.setUnderline(ofColor: tabBorderColor, andSize: borderSize) 116 | } 117 | 118 | func setupLabels(){ 119 | 120 | for label in labels { 121 | label.removeFromSuperview() 122 | } 123 | 124 | labels.removeAll(keepingCapacity: true) 125 | 126 | for index in 1...items.count { 127 | 128 | let label = UILabel(frame:CGRect(x: 0, y: 5, width: 70, height: 40)) 129 | label.text = items[index - 1] 130 | label.backgroundColor = UIColor.clear 131 | label.textAlignment = .center 132 | label.font = font 133 | label.textColor = index == 1 ? selectedLabelColor : unselectedLabelColor 134 | label.translatesAutoresizingMaskIntoConstraints = false 135 | self.addSubview(label) 136 | labels.append(label) 137 | } 138 | 139 | addIndividualItemConstraints(items: labels, mainView: self, padding: 0) 140 | } 141 | 142 | func setViewForLabel(label: UILabel) { 143 | var oldFrame = label.bounds 144 | let newWidth = oldFrame.width - 50 145 | oldFrame.size.width = newWidth 146 | label.frame = oldFrame 147 | } 148 | 149 | 150 | override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool { 151 | 152 | let location = touch.location(in: self) 153 | 154 | var calculatedIndex : Int? 155 | for (index, item) in labels.enumerated() { 156 | if item.frame.contains(location) { 157 | calculatedIndex = index 158 | } 159 | } 160 | 161 | 162 | if calculatedIndex != nil { 163 | selectedIndex = calculatedIndex! 164 | sendActions(for: .valueChanged) 165 | } 166 | 167 | return false 168 | } 169 | 170 | func displayNewSelectedIndex(){ 171 | for (_, item) in labels.enumerated() { 172 | item.textColor = unselectedLabelColor 173 | } 174 | 175 | let label = labels[selectedIndex] 176 | 177 | UIView.animate(withDuration: 0.5, delay: 0.0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.8, options: UIView.AnimationOptions.allowAnimatedContent, animations: { 178 | 179 | label.textColor = self.selectedLabelColor 180 | 181 | var newFrame = label.frame 182 | newFrame.origin.y = newFrame.height - self.thumUnderLineSize 183 | newFrame.size.height = self.thumUnderLineSize 184 | 185 | self.thumbView.frame = newFrame //label.frame 186 | 187 | }, completion: nil) 188 | } 189 | 190 | //MARK:- constraints 191 | func addIndividualItemConstraints(items: [UIView], mainView: UIView, padding: CGFloat) { 192 | 193 | for (index, button) in items.enumerated() { 194 | 195 | let topConstraint = NSLayoutConstraint(item: button, attribute: NSLayoutConstraint.Attribute.top, relatedBy: NSLayoutConstraint.Relation.equal, toItem: mainView, attribute: NSLayoutConstraint.Attribute.top, multiplier: 1.0, constant: 0) 196 | 197 | let bottomConstraint = NSLayoutConstraint(item: button, attribute: NSLayoutConstraint.Attribute.bottom, relatedBy: NSLayoutConstraint.Relation.equal, toItem: mainView, attribute: NSLayoutConstraint.Attribute.bottom, multiplier: 1.0, constant: 0) 198 | 199 | var rightConstraint : NSLayoutConstraint! 200 | 201 | if index == items.count - 1 { 202 | 203 | rightConstraint = NSLayoutConstraint(item: button, attribute: NSLayoutConstraint.Attribute.right, relatedBy: NSLayoutConstraint.Relation.equal, toItem: mainView, attribute: NSLayoutConstraint.Attribute.right, multiplier: 1.0, constant: -padding) 204 | 205 | }else{ 206 | 207 | let nextButton = items[index+1] 208 | rightConstraint = NSLayoutConstraint(item: button, attribute: NSLayoutConstraint.Attribute.right, relatedBy: NSLayoutConstraint.Relation.equal, toItem: nextButton, attribute: NSLayoutConstraint.Attribute.left, multiplier: 1.0, constant: -padding) 209 | } 210 | 211 | 212 | var leftConstraint : NSLayoutConstraint! 213 | 214 | if index == 0 { 215 | 216 | leftConstraint = NSLayoutConstraint(item: button, attribute: NSLayoutConstraint.Attribute.left, relatedBy: NSLayoutConstraint.Relation.equal, toItem: mainView, attribute: NSLayoutConstraint.Attribute.left, multiplier: 1.0, constant: padding) 217 | 218 | }else{ 219 | 220 | let prevButton = items[index-1] 221 | leftConstraint = NSLayoutConstraint(item: button, attribute: NSLayoutConstraint.Attribute.left, relatedBy: NSLayoutConstraint.Relation.equal, toItem: prevButton, attribute: NSLayoutConstraint.Attribute.right, multiplier: 1.0, constant: padding) 222 | 223 | let firstItem = items[0] 224 | 225 | let widthConstraint = NSLayoutConstraint(item: button, attribute: .width, relatedBy: NSLayoutConstraint.Relation.equal, toItem: firstItem, attribute: .width, multiplier: 1.0 , constant: 0) 226 | 227 | mainView.addConstraint(widthConstraint) 228 | } 229 | 230 | mainView.addConstraints([topConstraint, bottomConstraint, rightConstraint, leftConstraint]) 231 | } 232 | } 233 | 234 | func setSelectedColors(){ 235 | for item in labels { 236 | item.textColor = unselectedLabelColor 237 | } 238 | 239 | if labels.count > 0 { 240 | labels[0].textColor = selectedLabelColor 241 | } 242 | 243 | thumbView.backgroundColor = thumbColor 244 | } 245 | 246 | func setFont(){ 247 | for item in labels { 248 | item.font = font 249 | } 250 | } 251 | } 252 | 253 | extension UIView { 254 | 255 | func setUnderline(ofColor color:UIColor, andSize sized:CGFloat){ 256 | //Making UnderLIne BOrder on UitextFld 257 | let underLine = CALayer() 258 | underLine.frame = CGRect(x: 0, y: self.frame.size.height-1, width: self.frame.size.width, height: sized) 259 | underLine.backgroundColor = color.cgColor 260 | self.layer.addSublayer(underLine) 261 | } 262 | 263 | } 264 | -------------------------------------------------------------------------------- /DGSegmentedControl/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /DGSegmentedControl/ViewController.swift: -------------------------------------------------------------------------------- 1 | /****************************************************************************************************************** 2 | The MIT License (MIT) Copyright (c) 2014 Dip Kasyap (Devi Prasad Ghimire) 3 | 4 | email:- dpd.ghimire@gmail.com github : https://github.com/dipkasyap/DGSegmentedControl 5 | 6 | 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. 7 | 8 | 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 DGLocalization 9 | ******************************************************************************************************************/ 10 | 11 | import UIKit 12 | 13 | class ViewController: UIViewController { 14 | 15 | @IBOutlet weak var segmentedControl: DGSegmentedControl! 16 | @IBOutlet weak var displayGround: UIView! 17 | @IBOutlet weak var info: UILabel! 18 | 19 | override func viewDidLoad() { 20 | super.viewDidLoad() 21 | decorateSegmentedControl() 22 | } 23 | 24 | override func didReceiveMemoryWarning() { 25 | super.didReceiveMemoryWarning() 26 | // Dispose of any resources that can be recreated. 27 | } 28 | 29 | //MARK:- Action 30 | @IBAction func segmentValueChanged(_ sender: AnyObject) { 31 | 32 | if sender.selectedIndex == 0{ 33 | self.displayGround.backgroundColor = UIColor.gray 34 | self.info.text = "First Segment selected" 35 | } else { 36 | self.displayGround.backgroundColor = UIColor(red: 0.761, green: 0.722, blue: 0.580, alpha: 1.00) 37 | self.info.text = "Second Segment selected" 38 | } 39 | } 40 | 41 | //MARK:- Segment control 42 | func decorateSegmentedControl(){ 43 | 44 | segmentedControl.items = ["First Segment","Second Segment"] 45 | segmentedControl.font = UIFont(name: "Avenir-Black", size: 12) 46 | segmentedControl.borderColor = UIColor(red: 0.988, green: 0.820, blue: 0.447, alpha: 1.00) 47 | segmentedControl.selectedIndex = 0 48 | segmentedControl.borderSize = 2 49 | segmentedControl.thumbColor = UIColor(red: 0.988, green: 0.820, blue: 0.447, alpha: 1.00) 50 | segmentedControl.selectedLabelColor = UIColor.black 51 | segmentedControl.thumUnderLineSize = 8 52 | segmentedControl.font = UIFont.systemFont(ofSize: 18) 53 | self.segmentValueChanged(self.segmentedControl) 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Licence.md: -------------------------------------------------------------------------------- 1 | 2 | The MIT License (MIT) 3 | 4 | Copyright (c) 2014 Dip Kasyap (pr0gramm3r8hai) 5 | 6 | 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: 7 | 8 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 9 | 10 | 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. In App localization in Swift 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | 5 | # DGSegmentedControl 6 | Custom Segmented Control that has Full Feature customization on need of customisation. 7 | ![dgsegmentedconrtol](https://user-images.githubusercontent.com/12591229/30465794-24301d30-99f9-11e7-8be5-920bde161abc.png) 8 | # Supports Swift 3.0 9 | For Swift 2.X use previous release 10 | 11 | # Usage 12 | 1. Drag DGSegmentedControl folder in to your project. 13 | 14 | 2. Add UIView on storyboard which will work as segmented control for you. 15 | 16 | 3. Assign DGSegmentedControl class to that View from Identity Inspector 17 | 18 | 4. Drag outlet to Your View Controller and access like in demo project. 19 | 20 | //IBOutlet 21 | @IBOutlet weak var segmentedControl: DGSegmentedControl! 22 | 23 | override func viewDidLoad() { 24 | super.viewDidLoad() 25 | //setup 26 | setupSegments() 27 | } 28 | 29 | //setup 30 | private func setupSegments() { 31 | 32 | segmentControl.items = ["First Segment","Second Segment"] 33 | segmentControl.font = UIFont(name: "Avenir-Black", size: 12) 34 | segmentControl.borderColor = AppConstants.Color.mportGreen 35 | segmentControl.selectedIndex = 0 36 | segmentControl.borderSize = 2 37 | segmentControl.thumbColor = AppConstants.Color.mportGreen 38 | segmentControl.selectedLabelColor = AppConstants.Color.mportGreen 39 | segmentControl.thumUnderLineSize = 8 40 | segmentControl.font = UIFont.systemFont(ofSize: 18) 41 | segmentControl.addTarget(self, action:#selector(segmentValueChanged(segmentControl:)), for: .valueChanged) 42 | } 43 | 44 | //MARK:- Actions 45 | @objc func segmentValueChanged(segmentControl: DGSegmentedControl){ 46 | if segmentControl.selectedIndex == 0 { 47 | } 48 | } 49 | 50 | # Licence 51 | 52 | The MIT License (MIT) Copyright (c) 2014 Dip Kasyap (Devi Prasad Ghimire) 53 | 54 | email:- dpd.ghimire@gmail.com github : https://github.com/dipkasyap/DGSegmentedControl 55 | 56 | 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. 57 | 58 | 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 DGLocalization 59 | 60 | --------------------------------------------------------------------------------