├── .gitignore
├── Images
├── Screenshot.png
└── TKSegmentView Logo.png
├── LICENSE
├── README.md
└── TKSegmentProgressView
├── TKSegmentView.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ └── IDEWorkspaceChecks.plist
└── TKSegmentView
├── AppDelegate.swift
├── Assets.xcassets
├── AppIcon.appiconset
│ └── Contents.json
└── Contents.json
├── Base.lproj
├── LaunchScreen.storyboard
└── Main.storyboard
├── Info.plist
├── SegmentedProgressView.swift
├── TKItemView.swift
├── TKSegmentView.swift
└── ViewController.swift
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xccheckout
23 | *.xcscmblueprint
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 | *.ipa
28 | *.dSYM.zip
29 | *.dSYM
30 |
31 | ## Playgrounds
32 | timeline.xctimeline
33 | playground.xcworkspace
34 |
35 | # Swift Package Manager
36 | #
37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
38 | # Packages/
39 | # Package.pins
40 | # Package.resolved
41 | .build/
42 |
43 | # CocoaPods
44 | #
45 | # We recommend against adding the Pods directory to your .gitignore. However
46 | # you should judge for yourself, the pros and cons are mentioned at:
47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
48 | #
49 | # Pods/
50 |
51 | # Carthage
52 | #
53 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
54 | # Carthage/Checkouts
55 |
56 | Carthage/Build
57 |
58 | # fastlane
59 | #
60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
61 | # screenshots whenever they are needed.
62 | # For more information about the recommended setup visit:
63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
64 |
65 | fastlane/report.xml
66 | fastlane/Preview.html
67 | fastlane/screenshots/**/*.png
68 | fastlane/test_output
69 |
--------------------------------------------------------------------------------
/Images/Screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toseefkhilji/TKSegmentView/4af1cff662be70b56db08f1dc3b4e5377f493df4/Images/Screenshot.png
--------------------------------------------------------------------------------
/Images/TKSegmentView Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/toseefkhilji/TKSegmentView/4af1cff662be70b56db08f1dc3b4e5377f493df4/Images/TKSegmentView Logo.png
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Toseef
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | [](https://github.com/toseefkhilji/TKProgressView/blob/master/LICENSE?raw=true)
8 | 
9 | 
10 |
11 | Whatsapp status style Progress control
12 |
13 |
14 | ## Demo
15 |
16 | 
17 |
18 |
19 | ## Usage
20 |
21 | ## Customization
22 |
23 |
24 | ## Installation
25 |
26 | #### CocoaPods
27 |
28 |
29 | #### Manually
30 |
31 | ## TODO
32 | - [ ] Complete README
33 | - [ ] More Customization
34 | - [ ] Carthage Support
35 | - [ ] Unit Test
36 |
37 | License
38 | -------
39 |
40 | TKSegmentView is available under the MIT license. See the LICENSE file for more info.
41 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 50;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 21FB86C92140FC1700E392F0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FB86C82140FC1700E392F0 /* AppDelegate.swift */; };
11 | 21FB86CB2140FC1700E392F0 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FB86CA2140FC1700E392F0 /* ViewController.swift */; };
12 | 21FB86CE2140FC1700E392F0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 21FB86CC2140FC1700E392F0 /* Main.storyboard */; };
13 | 21FB86D02140FC2900E392F0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 21FB86CF2140FC2900E392F0 /* Assets.xcassets */; };
14 | 21FB86D32140FC2900E392F0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 21FB86D12140FC2900E392F0 /* LaunchScreen.storyboard */; };
15 | 21FB86DD2140FC4200E392F0 /* TKSegmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FB86DA2140FC4100E392F0 /* TKSegmentView.swift */; };
16 | 21FB86E1214144B000E392F0 /* TKItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 21FB86E0214144AF00E392F0 /* TKItemView.swift */; };
17 | /* End PBXBuildFile section */
18 |
19 | /* Begin PBXFileReference section */
20 | 21FB86C52140FC1700E392F0 /* TKSegmentView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TKSegmentView.app; sourceTree = BUILT_PRODUCTS_DIR; };
21 | 21FB86C82140FC1700E392F0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
22 | 21FB86CA2140FC1700E392F0 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
23 | 21FB86CD2140FC1700E392F0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
24 | 21FB86CF2140FC2900E392F0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
25 | 21FB86D22140FC2900E392F0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
26 | 21FB86D42140FC2900E392F0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
27 | 21FB86DA2140FC4100E392F0 /* TKSegmentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TKSegmentView.swift; sourceTree = ""; };
28 | 21FB86E0214144AF00E392F0 /* TKItemView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TKItemView.swift; sourceTree = ""; };
29 | /* End PBXFileReference section */
30 |
31 | /* Begin PBXFrameworksBuildPhase section */
32 | 21FB86C22140FC1700E392F0 /* Frameworks */ = {
33 | isa = PBXFrameworksBuildPhase;
34 | buildActionMask = 2147483647;
35 | files = (
36 | );
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXFrameworksBuildPhase section */
40 |
41 | /* Begin PBXGroup section */
42 | 21FB86BC2140FC1700E392F0 = {
43 | isa = PBXGroup;
44 | children = (
45 | 21FB86C72140FC1700E392F0 /* TKSegmentView */,
46 | 21FB86C62140FC1700E392F0 /* Products */,
47 | );
48 | sourceTree = "";
49 | };
50 | 21FB86C62140FC1700E392F0 /* Products */ = {
51 | isa = PBXGroup;
52 | children = (
53 | 21FB86C52140FC1700E392F0 /* TKSegmentView.app */,
54 | );
55 | name = Products;
56 | sourceTree = "";
57 | };
58 | 21FB86C72140FC1700E392F0 /* TKSegmentView */ = {
59 | isa = PBXGroup;
60 | children = (
61 | 21FB86DA2140FC4100E392F0 /* TKSegmentView.swift */,
62 | 21FB86E0214144AF00E392F0 /* TKItemView.swift */,
63 | 21FB86C82140FC1700E392F0 /* AppDelegate.swift */,
64 | 21FB86CA2140FC1700E392F0 /* ViewController.swift */,
65 | 21FB86CC2140FC1700E392F0 /* Main.storyboard */,
66 | 21FB86CF2140FC2900E392F0 /* Assets.xcassets */,
67 | 21FB86D12140FC2900E392F0 /* LaunchScreen.storyboard */,
68 | 21FB86D42140FC2900E392F0 /* Info.plist */,
69 | );
70 | path = TKSegmentView;
71 | sourceTree = "";
72 | };
73 | /* End PBXGroup section */
74 |
75 | /* Begin PBXNativeTarget section */
76 | 21FB86C42140FC1700E392F0 /* TKSegmentView */ = {
77 | isa = PBXNativeTarget;
78 | buildConfigurationList = 21FB86D72140FC2900E392F0 /* Build configuration list for PBXNativeTarget "TKSegmentView" */;
79 | buildPhases = (
80 | 21FB86C12140FC1700E392F0 /* Sources */,
81 | 21FB86C22140FC1700E392F0 /* Frameworks */,
82 | 21FB86C32140FC1700E392F0 /* Resources */,
83 | );
84 | buildRules = (
85 | );
86 | dependencies = (
87 | );
88 | name = TKSegmentView;
89 | productName = TKProgressView;
90 | productReference = 21FB86C52140FC1700E392F0 /* TKSegmentView.app */;
91 | productType = "com.apple.product-type.application";
92 | };
93 | /* End PBXNativeTarget section */
94 |
95 | /* Begin PBXProject section */
96 | 21FB86BD2140FC1700E392F0 /* Project object */ = {
97 | isa = PBXProject;
98 | attributes = {
99 | LastSwiftUpdateCheck = 0940;
100 | LastUpgradeCheck = 0940;
101 | ORGANIZATIONNAME = ASApps;
102 | TargetAttributes = {
103 | 21FB86C42140FC1700E392F0 = {
104 | CreatedOnToolsVersion = 9.4;
105 | };
106 | };
107 | };
108 | buildConfigurationList = 21FB86C02140FC1700E392F0 /* Build configuration list for PBXProject "TKSegmentView" */;
109 | compatibilityVersion = "Xcode 9.3";
110 | developmentRegion = en;
111 | hasScannedForEncodings = 0;
112 | knownRegions = (
113 | en,
114 | Base,
115 | );
116 | mainGroup = 21FB86BC2140FC1700E392F0;
117 | productRefGroup = 21FB86C62140FC1700E392F0 /* Products */;
118 | projectDirPath = "";
119 | projectRoot = "";
120 | targets = (
121 | 21FB86C42140FC1700E392F0 /* TKSegmentView */,
122 | );
123 | };
124 | /* End PBXProject section */
125 |
126 | /* Begin PBXResourcesBuildPhase section */
127 | 21FB86C32140FC1700E392F0 /* Resources */ = {
128 | isa = PBXResourcesBuildPhase;
129 | buildActionMask = 2147483647;
130 | files = (
131 | 21FB86D32140FC2900E392F0 /* LaunchScreen.storyboard in Resources */,
132 | 21FB86D02140FC2900E392F0 /* Assets.xcassets in Resources */,
133 | 21FB86CE2140FC1700E392F0 /* Main.storyboard in Resources */,
134 | );
135 | runOnlyForDeploymentPostprocessing = 0;
136 | };
137 | /* End PBXResourcesBuildPhase section */
138 |
139 | /* Begin PBXSourcesBuildPhase section */
140 | 21FB86C12140FC1700E392F0 /* Sources */ = {
141 | isa = PBXSourcesBuildPhase;
142 | buildActionMask = 2147483647;
143 | files = (
144 | 21FB86CB2140FC1700E392F0 /* ViewController.swift in Sources */,
145 | 21FB86C92140FC1700E392F0 /* AppDelegate.swift in Sources */,
146 | 21FB86E1214144B000E392F0 /* TKItemView.swift in Sources */,
147 | 21FB86DD2140FC4200E392F0 /* TKSegmentView.swift in Sources */,
148 | );
149 | runOnlyForDeploymentPostprocessing = 0;
150 | };
151 | /* End PBXSourcesBuildPhase section */
152 |
153 | /* Begin PBXVariantGroup section */
154 | 21FB86CC2140FC1700E392F0 /* Main.storyboard */ = {
155 | isa = PBXVariantGroup;
156 | children = (
157 | 21FB86CD2140FC1700E392F0 /* Base */,
158 | );
159 | name = Main.storyboard;
160 | sourceTree = "";
161 | };
162 | 21FB86D12140FC2900E392F0 /* LaunchScreen.storyboard */ = {
163 | isa = PBXVariantGroup;
164 | children = (
165 | 21FB86D22140FC2900E392F0 /* Base */,
166 | );
167 | name = LaunchScreen.storyboard;
168 | sourceTree = "";
169 | };
170 | /* End PBXVariantGroup section */
171 |
172 | /* Begin XCBuildConfiguration section */
173 | 21FB86D52140FC2900E392F0 /* Debug */ = {
174 | isa = XCBuildConfiguration;
175 | buildSettings = {
176 | ALWAYS_SEARCH_USER_PATHS = NO;
177 | CLANG_ANALYZER_NONNULL = YES;
178 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
179 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
180 | CLANG_CXX_LIBRARY = "libc++";
181 | CLANG_ENABLE_MODULES = YES;
182 | CLANG_ENABLE_OBJC_ARC = YES;
183 | CLANG_ENABLE_OBJC_WEAK = YES;
184 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
185 | CLANG_WARN_BOOL_CONVERSION = YES;
186 | CLANG_WARN_COMMA = YES;
187 | CLANG_WARN_CONSTANT_CONVERSION = YES;
188 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
189 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
190 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
191 | CLANG_WARN_EMPTY_BODY = YES;
192 | CLANG_WARN_ENUM_CONVERSION = YES;
193 | CLANG_WARN_INFINITE_RECURSION = YES;
194 | CLANG_WARN_INT_CONVERSION = YES;
195 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
196 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
197 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
198 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
199 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
200 | CLANG_WARN_STRICT_PROTOTYPES = YES;
201 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
202 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
203 | CLANG_WARN_UNREACHABLE_CODE = YES;
204 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
205 | CODE_SIGN_IDENTITY = "iPhone Developer";
206 | COPY_PHASE_STRIP = NO;
207 | DEBUG_INFORMATION_FORMAT = dwarf;
208 | ENABLE_STRICT_OBJC_MSGSEND = YES;
209 | ENABLE_TESTABILITY = YES;
210 | GCC_C_LANGUAGE_STANDARD = gnu11;
211 | GCC_DYNAMIC_NO_PIC = NO;
212 | GCC_NO_COMMON_BLOCKS = YES;
213 | GCC_OPTIMIZATION_LEVEL = 0;
214 | GCC_PREPROCESSOR_DEFINITIONS = (
215 | "DEBUG=1",
216 | "$(inherited)",
217 | );
218 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
219 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
220 | GCC_WARN_UNDECLARED_SELECTOR = YES;
221 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
222 | GCC_WARN_UNUSED_FUNCTION = YES;
223 | GCC_WARN_UNUSED_VARIABLE = YES;
224 | IPHONEOS_DEPLOYMENT_TARGET = 11.4;
225 | MTL_ENABLE_DEBUG_INFO = YES;
226 | ONLY_ACTIVE_ARCH = YES;
227 | SDKROOT = iphoneos;
228 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
229 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
230 | };
231 | name = Debug;
232 | };
233 | 21FB86D62140FC2900E392F0 /* Release */ = {
234 | isa = XCBuildConfiguration;
235 | buildSettings = {
236 | ALWAYS_SEARCH_USER_PATHS = NO;
237 | CLANG_ANALYZER_NONNULL = YES;
238 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
239 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
240 | CLANG_CXX_LIBRARY = "libc++";
241 | CLANG_ENABLE_MODULES = YES;
242 | CLANG_ENABLE_OBJC_ARC = YES;
243 | CLANG_ENABLE_OBJC_WEAK = YES;
244 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
245 | CLANG_WARN_BOOL_CONVERSION = YES;
246 | CLANG_WARN_COMMA = YES;
247 | CLANG_WARN_CONSTANT_CONVERSION = YES;
248 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
250 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
251 | CLANG_WARN_EMPTY_BODY = YES;
252 | CLANG_WARN_ENUM_CONVERSION = YES;
253 | CLANG_WARN_INFINITE_RECURSION = YES;
254 | CLANG_WARN_INT_CONVERSION = YES;
255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
256 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
257 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
258 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
259 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
260 | CLANG_WARN_STRICT_PROTOTYPES = YES;
261 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
262 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
263 | CLANG_WARN_UNREACHABLE_CODE = YES;
264 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
265 | CODE_SIGN_IDENTITY = "iPhone Developer";
266 | COPY_PHASE_STRIP = NO;
267 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
268 | ENABLE_NS_ASSERTIONS = NO;
269 | ENABLE_STRICT_OBJC_MSGSEND = YES;
270 | GCC_C_LANGUAGE_STANDARD = gnu11;
271 | GCC_NO_COMMON_BLOCKS = YES;
272 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
273 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
274 | GCC_WARN_UNDECLARED_SELECTOR = YES;
275 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
276 | GCC_WARN_UNUSED_FUNCTION = YES;
277 | GCC_WARN_UNUSED_VARIABLE = YES;
278 | IPHONEOS_DEPLOYMENT_TARGET = 11.4;
279 | MTL_ENABLE_DEBUG_INFO = NO;
280 | SDKROOT = iphoneos;
281 | SWIFT_COMPILATION_MODE = wholemodule;
282 | SWIFT_OPTIMIZATION_LEVEL = "-O";
283 | VALIDATE_PRODUCT = YES;
284 | };
285 | name = Release;
286 | };
287 | 21FB86D82140FC2900E392F0 /* Debug */ = {
288 | isa = XCBuildConfiguration;
289 | buildSettings = {
290 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
291 | CODE_SIGN_STYLE = Manual;
292 | DEVELOPMENT_TEAM = BEV2Z98CJ8;
293 | INFOPLIST_FILE = "$(SRCROOT)/TKSegmentView/Info.plist";
294 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
295 | LD_RUNPATH_SEARCH_PATHS = (
296 | "$(inherited)",
297 | "@executable_path/Frameworks",
298 | );
299 | PRODUCT_BUNDLE_IDENTIFIER = com.ASApps.TKProgressView;
300 | PRODUCT_NAME = "$(TARGET_NAME)";
301 | PROVISIONING_PROFILE_SPECIFIER = WildCard;
302 | SWIFT_VERSION = 4.0;
303 | TARGETED_DEVICE_FAMILY = "1,2";
304 | };
305 | name = Debug;
306 | };
307 | 21FB86D92140FC2900E392F0 /* Release */ = {
308 | isa = XCBuildConfiguration;
309 | buildSettings = {
310 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
311 | CODE_SIGN_STYLE = Manual;
312 | DEVELOPMENT_TEAM = BEV2Z98CJ8;
313 | INFOPLIST_FILE = "$(SRCROOT)/TKSegmentView/Info.plist";
314 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
315 | LD_RUNPATH_SEARCH_PATHS = (
316 | "$(inherited)",
317 | "@executable_path/Frameworks",
318 | );
319 | PRODUCT_BUNDLE_IDENTIFIER = com.ASApps.TKProgressView;
320 | PRODUCT_NAME = "$(TARGET_NAME)";
321 | PROVISIONING_PROFILE_SPECIFIER = WildCard;
322 | SWIFT_VERSION = 4.0;
323 | TARGETED_DEVICE_FAMILY = "1,2";
324 | };
325 | name = Release;
326 | };
327 | /* End XCBuildConfiguration section */
328 |
329 | /* Begin XCConfigurationList section */
330 | 21FB86C02140FC1700E392F0 /* Build configuration list for PBXProject "TKSegmentView" */ = {
331 | isa = XCConfigurationList;
332 | buildConfigurations = (
333 | 21FB86D52140FC2900E392F0 /* Debug */,
334 | 21FB86D62140FC2900E392F0 /* Release */,
335 | );
336 | defaultConfigurationIsVisible = 0;
337 | defaultConfigurationName = Release;
338 | };
339 | 21FB86D72140FC2900E392F0 /* Build configuration list for PBXNativeTarget "TKSegmentView" */ = {
340 | isa = XCConfigurationList;
341 | buildConfigurations = (
342 | 21FB86D82140FC2900E392F0 /* Debug */,
343 | 21FB86D92140FC2900E392F0 /* Release */,
344 | );
345 | defaultConfigurationIsVisible = 0;
346 | defaultConfigurationName = Release;
347 | };
348 | /* End XCConfigurationList section */
349 | };
350 | rootObject = 21FB86BD2140FC1700E392F0 /* Project object */;
351 | }
352 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // TKProgressView
4 | //
5 | // Created by Toseef Khilji on 06/09/18.
6 | // Copyright © 2018 ASApps. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // 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.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // 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.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // 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.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "20x20",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "20x20",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "29x29",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "29x29",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "40x40",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "40x40",
31 | "scale" : "3x"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "size" : "60x60",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "size" : "60x60",
41 | "scale" : "3x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "20x20",
46 | "scale" : "1x"
47 | },
48 | {
49 | "idiom" : "ipad",
50 | "size" : "20x20",
51 | "scale" : "2x"
52 | },
53 | {
54 | "idiom" : "ipad",
55 | "size" : "29x29",
56 | "scale" : "1x"
57 | },
58 | {
59 | "idiom" : "ipad",
60 | "size" : "29x29",
61 | "scale" : "2x"
62 | },
63 | {
64 | "idiom" : "ipad",
65 | "size" : "40x40",
66 | "scale" : "1x"
67 | },
68 | {
69 | "idiom" : "ipad",
70 | "size" : "40x40",
71 | "scale" : "2x"
72 | },
73 | {
74 | "idiom" : "ipad",
75 | "size" : "76x76",
76 | "scale" : "1x"
77 | },
78 | {
79 | "idiom" : "ipad",
80 | "size" : "76x76",
81 | "scale" : "2x"
82 | },
83 | {
84 | "idiom" : "ipad",
85 | "size" : "83.5x83.5",
86 | "scale" : "2x"
87 | },
88 | {
89 | "idiom" : "ios-marketing",
90 | "size" : "1024x1024",
91 | "scale" : "1x"
92 | }
93 | ],
94 | "info" : {
95 | "version" : 1,
96 | "author" : "xcode"
97 | }
98 | }
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/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 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/SegmentedProgressView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SegmentedProgressView.swift
3 | // Pods
4 | //
5 | // Created by Sapozhnik Ivan on 12/05/17.
6 | //
7 | //
8 |
9 | import UIKit
10 |
11 | public class TKSegmentProgressView: UIView, ProgressBarElementViewDelegate {
12 |
13 | public weak var delegate: ProgressBarDelegate?
14 |
15 | override public var frame: CGRect {
16 | didSet {
17 | redraw()
18 | }
19 | }
20 |
21 | public var progressTintColor: UIColor? {
22 | didSet {
23 | redraw()
24 | }
25 | }
26 |
27 | public var trackTintColor: UIColor? {
28 | didSet {
29 | redraw()
30 | }
31 | }
32 |
33 | public var itemSpace: Double? {
34 | didSet {
35 | redraw()
36 | }
37 | }
38 |
39 | public var items: [ProgressItem]? {
40 | didSet {
41 | redraw()
42 | }
43 | }
44 |
45 | public var isAutoProgress: Bool = false
46 |
47 | var elementViews: [SegmentView] = []
48 |
49 | var currentIndex: Int = 0
50 |
51 | public init(withItems items: [ProgressItem]!) {
52 | self.items = items
53 | super.init(frame: .zero)
54 | self.backgroundColor = .clear
55 | }
56 |
57 | required public init?(coder aDecoder: NSCoder) {
58 | super.init(coder: aDecoder)
59 | }
60 |
61 | override public func layoutSubviews() {
62 | super.layoutSubviews()
63 | redraw()
64 | }
65 |
66 | fileprivate func redraw() {
67 | clear()
68 | draw()
69 | }
70 |
71 | fileprivate func clear() {
72 |
73 | elementViews.removeAll()
74 | for view in subviews {
75 | view.removeFromSuperview()
76 | }
77 | }
78 |
79 | fileprivate func draw() {
80 |
81 | let items = self.items ?? [ProgressItem(withDuration: 6) { print("finished 0") }]
82 |
83 | let horizontalSpace: Double = itemSpace ?? 6.0
84 |
85 | var elementWidth = ((Double(bounds.width) + horizontalSpace) / Double(items.count))
86 | elementWidth -= horizontalSpace
87 |
88 | if elementWidth <= 0 { return }
89 |
90 | var xOffset: Double = 0.0
91 |
92 | for item in items {
93 |
94 | let elementView = SegmentView(withItem: item)
95 | elementView.progressTintColor = self.progressTintColor
96 | elementView.trackTintColor = self.trackTintColor
97 | elementView.delegate = self
98 | elementView.frame = CGRect(x: xOffset, y: 0, width: elementWidth, height: Double(bounds.height))
99 | elementView.drawEmpty()
100 | self.addSubview(elementView)
101 | elementViews.append(elementView)
102 | xOffset += elementWidth + horizontalSpace
103 | }
104 |
105 | let elementView = elementViews[0]
106 | delegate?.progressBar(willDisplayItemAtIndex: 0)
107 | elementView.animate()
108 | }
109 |
110 |
111 | public func selectItem(at index: Int) {
112 |
113 | if index >= currentIndex {
114 | currentIndex = index
115 | }
116 |
117 | for (indx, elementview)in elementViews.enumerated() {
118 | if index == indx {
119 | elementview.animate()
120 | delegate?.progressBar(willDisplayItemAtIndex: index)
121 | currentIndex = index
122 | } else if indx < currentIndex {
123 | elementview.drawFilled()
124 | } else {
125 | elementview.drawEmpty()
126 | }
127 | }
128 | }
129 |
130 |
131 | public func progressBar(didFinishWithElement element: SegmentView) {
132 |
133 | let elements = self.items ?? [ProgressItem(withDuration: 6) { print("finished 0") }]
134 |
135 | if var index = elementViews.index(of: element) {
136 |
137 | delegate?.progressBar(didDisplayItemAtIndex: index)
138 |
139 | if isAutoProgress {
140 | index += 1
141 | if index < elements.count {
142 | let elementView = elementViews[index]
143 | delegate?.progressBar(willDisplayItemAtIndex: index)
144 | currentIndex = index
145 | elementView.animate()
146 | }
147 | }
148 | }
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/TKItemView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SegmentView.swift
3 | // TKSegmentView
4 | //
5 | // Created by Toseef Khilji on 06/09/18.
6 | // Copyright © 2018 ASApps. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public protocol TKSegmentViewDelegate: class {
12 |
13 | func progressBar(willDisplayItemAtIndex index: Int)
14 | func progressBar(didDisplayItemAtIndex index: Int)
15 | }
16 |
17 | public protocol TKItemViewDelegate: class {
18 |
19 | func progressBar(didFinishWithElement element: TKItemView)
20 | }
21 |
22 | public class TKItemView: UIView {
23 |
24 | weak var delegate: TKItemViewDelegate?
25 | let item: SegmentItem
26 |
27 | var progressTintColor: UIColor?
28 | var trackTintColor: UIColor?
29 |
30 | init(withItem item: SegmentItem!) {
31 | self.item = item
32 | super.init(frame: .zero)
33 | }
34 |
35 | required public init?(coder aDecoder: NSCoder) {
36 | fatalError("init(coder:) has not been implemented")
37 | }
38 |
39 | func drawEmpty() {
40 |
41 | let emptyColor = trackTintColor ?? .lightGray
42 | let emptyShape = CAShapeLayer()
43 | emptyShape.frame = self.bounds
44 | emptyShape.backgroundColor = emptyColor.cgColor
45 | emptyShape.cornerRadius = bounds.height / 2
46 | self.layer.addSublayer(emptyShape)
47 | }
48 |
49 | func drawFilled() {
50 |
51 | let fillColor = progressTintColor ?? .darkGray
52 | let emptyShape = CAShapeLayer()
53 | emptyShape.frame = self.bounds
54 | emptyShape.backgroundColor = fillColor.cgColor
55 | emptyShape.cornerRadius = bounds.height / 2
56 | self.layer.addSublayer(emptyShape)
57 | }
58 |
59 | func animate() {
60 |
61 | let fillColor = progressTintColor ?? .darkGray
62 | let startPath = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: bounds.height, height: bounds.height), cornerRadius: bounds.height / 2).cgPath
63 | let endPath = UIBezierPath(roundedRect: bounds, cornerRadius: bounds.height / 2)
64 |
65 | let filledShape = CAShapeLayer()
66 | filledShape.path = startPath
67 | filledShape.fillColor = fillColor.cgColor
68 | self.layer.addSublayer(filledShape)
69 |
70 | CATransaction.begin()
71 | CATransaction.setCompletionBlock({
72 | self.delegate?.progressBar(didFinishWithElement: self)
73 | self.item.handler?()
74 | })
75 |
76 | let animation = CABasicAnimation(keyPath: "path")
77 | animation.toValue = endPath.cgPath
78 | animation.duration = self.item.duration
79 | animation.repeatCount = 1
80 | animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear)
81 | animation.fillMode = kCAFillModeBoth
82 | animation.isRemovedOnCompletion = false
83 |
84 | filledShape.add(animation, forKey: animation.keyPath)
85 | CATransaction.commit()
86 | }
87 | }
88 |
89 |
90 | public class SegmentItem {
91 |
92 | public typealias CompletionHanlder = () -> ()
93 |
94 | let duration: Double
95 | let handler: CompletionHanlder?
96 |
97 | public init(withDuration duration: Double = 0.5, handler completion: CompletionHanlder? = nil) {
98 | self.duration = duration
99 | self.handler = completion
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/TKSegmentView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // TKSegmentView.swift
3 | // TKSegmentView
4 | //
5 | // Created by Toseef Khilji on 06/09/18.
6 | // Copyright © 2018 ASApps. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class TKSegmentView: UIView, TKItemViewDelegate {
12 |
13 | public weak var delegate: TKSegmentViewDelegate?
14 |
15 | override public var frame: CGRect {
16 | didSet {
17 | redraw()
18 | }
19 | }
20 |
21 | public var progressTintColor: UIColor? {
22 | didSet {
23 | redraw()
24 | }
25 | }
26 |
27 | public var trackTintColor: UIColor? {
28 | didSet {
29 | redraw()
30 | }
31 | }
32 |
33 | public var itemSpace: Double? {
34 | didSet {
35 | redraw()
36 | }
37 | }
38 |
39 | public var segments: [SegmentItem]? {
40 | didSet {
41 | redraw()
42 | }
43 | }
44 |
45 | public var isAutoProgress: Bool = false
46 |
47 | var segmentViews: [TKItemView] = []
48 |
49 | var currentIndex: Int = 0
50 |
51 | public init(withItems items: [SegmentItem]!) {
52 | self.segments = items
53 | super.init(frame: .zero)
54 | self.backgroundColor = .clear
55 | }
56 |
57 | required public init?(coder aDecoder: NSCoder) {
58 | super.init(coder: aDecoder)
59 | }
60 |
61 | override public func layoutSubviews() {
62 | super.layoutSubviews()
63 | redraw()
64 | }
65 |
66 | fileprivate func redraw() {
67 | clear()
68 | draw()
69 | }
70 |
71 | fileprivate func clear() {
72 |
73 | segmentViews.removeAll()
74 | for view in subviews {
75 | view.removeFromSuperview()
76 | }
77 | }
78 |
79 | fileprivate func draw() {
80 |
81 | guard let segments = self.segments, segments.count > 0 else { return }
82 |
83 | let horizontalSpace: Double = itemSpace ?? 6.0
84 |
85 | var elementWidth = ((Double(bounds.width) + horizontalSpace) / Double(segments.count))
86 | elementWidth -= horizontalSpace
87 |
88 | if elementWidth <= 0 { return }
89 |
90 | var xOffset: Double = 0.0
91 |
92 | for item in segments {
93 |
94 | let elementView = TKItemView(withItem: item)
95 | elementView.progressTintColor = self.progressTintColor
96 | elementView.trackTintColor = self.trackTintColor
97 | elementView.delegate = self
98 | elementView.frame = CGRect(x: xOffset, y: 0, width: elementWidth, height: Double(bounds.height))
99 | elementView.drawEmpty()
100 | self.addSubview(elementView)
101 | segmentViews.append(elementView)
102 | xOffset += elementWidth + horizontalSpace
103 | }
104 |
105 | let elementView = segmentViews[0]
106 | delegate?.progressBar(willDisplayItemAtIndex: 0)
107 | elementView.animate()
108 | }
109 |
110 |
111 | public func selectItem(at index: Int) {
112 |
113 | if index >= currentIndex {
114 | currentIndex = index
115 | }
116 |
117 | for (indx, elementview)in segmentViews.enumerated() {
118 | if index == indx {
119 | elementview.animate()
120 | delegate?.progressBar(willDisplayItemAtIndex: index)
121 | currentIndex = index
122 | } else if indx < currentIndex {
123 | elementview.drawFilled()
124 | } else {
125 | elementview.drawEmpty()
126 | }
127 | }
128 | }
129 |
130 | public func progressBar(didFinishWithElement element: TKItemView) {
131 |
132 | guard let segments = self.segments, segments.count > 0 else { return }
133 |
134 | if var index = segmentViews.index(of: element) {
135 |
136 | delegate?.progressBar(didDisplayItemAtIndex: index)
137 |
138 | if isAutoProgress {
139 | index += 1
140 | if index < segments.count {
141 | let elementView = segmentViews[index]
142 | delegate?.progressBar(willDisplayItemAtIndex: index)
143 | currentIndex = index
144 | elementView.animate()
145 | }
146 | }
147 | }
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/TKSegmentProgressView/TKSegmentView/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // TKProgressView
4 | //
5 | // Created by Toseef Khilji on 06/09/18.
6 | // Copyright © 2018 ASApps. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ViewController: UIViewController, TKSegmentViewDelegate {
12 |
13 | var progressView: TKSegmentView!
14 | var items: [SegmentItem] = []
15 |
16 | override func viewDidLoad() {
17 | super.viewDidLoad()
18 |
19 | for _ in 0...3 {
20 | items.append(SegmentItem())
21 | }
22 | let elementWithCompletion = SegmentItem(withDuration: 2) {
23 | print("elementWithCompletion finished")
24 | }
25 |
26 | items.append(elementWithCompletion)
27 | progressView = TKSegmentView(withItems: items)
28 | progressView.progressTintColor = UIColor(red: 39/255.0, green: 174/255.0, blue: 96/255.0, alpha: 1.0)
29 | progressView.trackTintColor = UIColor.lightGray
30 | // progressView.isAutoProgress = true
31 | progressView.delegate = self
32 | progressView.backgroundColor = .white
33 | progressView.itemSpace = 5.0
34 | progressView.frame = CGRect(x: 20, y: 80, width: view.bounds.width - 40, height: 5)
35 | view.addSubview(progressView)
36 | }
37 |
38 | func progressBar(willDisplayItemAtIndex index: Int) {
39 | print("willDisplayItemAtIndex \(index)")
40 | }
41 |
42 | func progressBar(didDisplayItemAtIndex index: Int) {
43 | print("didDisplayItemAtIndex \(index)")
44 | }
45 |
46 | @IBAction func change(_ sender: UISegmentedControl) {
47 | progressView.selectItem(at: sender.selectedSegmentIndex)
48 | }
49 | }
50 |
51 |
--------------------------------------------------------------------------------