├── images
├── properties.png
├── styles_01.png
├── styles_02.png
├── scr_MyStyle.png
├── scr_AddSubViewEx_01.png
├── scr_AddSubViewEx_02.png
├── scr_BlueDarkStyle_01.png
└── scr_BlueDarkStyle_02.png
├── GCProgressSample
├── GCProgressSample.xcodeproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── xcshareddata
│ │ └── xcschemes
│ │ │ └── GradientCircularProgress.xcscheme
│ └── project.pbxproj
├── GradientCircularProgress
│ ├── GradientCircularProgress.h
│ ├── Info.plist
│ ├── Progress
│ │ ├── Elements
│ │ │ ├── WindowBuilder.swift
│ │ │ ├── Background.swift
│ │ │ ├── ArcView.swift
│ │ │ ├── GradientArcView.swift
│ │ │ └── GradientArcWithClearColorView.swift
│ │ ├── Property.swift
│ │ ├── Core
│ │ │ ├── ProgressAtRatioView.swift
│ │ │ └── CircularProgressView.swift
│ │ ├── ProgressView.swift
│ │ └── ProgressViewController.swift
│ ├── Styles
│ │ ├── OrangeClearStyle.swift
│ │ ├── BlueIndicatorStyle.swift
│ │ ├── BlueDarkStyle.swift
│ │ ├── GreenLightStyle.swift
│ │ └── Style.swift
│ ├── Utils
│ │ └── ColorUtil.swift
│ └── GradientCircularProgress.swift
├── GCProgressSample
│ ├── AsyncUtil.swift
│ ├── MyStyle.swift
│ ├── BackgroundTransparentStyle.swift
│ ├── Info.plist
│ ├── MyButton.swift
│ ├── Images.xcassets
│ │ └── AppIcon.appiconset
│ │ │ └── Contents.json
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── LaunchScreen.xib
│ │ └── Main.storyboard
│ ├── AlertHelperKit.swift
│ └── ViewController.swift
└── GCProgressSampleTests
│ ├── Info.plist
│ └── GCProgressSampleTests.swift
├── GradientCircularProgress.podspec
├── source
├── GradientCircularProgress.h
├── Progress
│ ├── Elements
│ │ ├── WindowBuilder.swift
│ │ ├── Background.swift
│ │ ├── ArcView.swift
│ │ ├── GradientArcView.swift
│ │ └── GradientArcWithClearColorView.swift
│ ├── Property.swift
│ ├── Core
│ │ ├── ProgressAtRatioView.swift
│ │ └── CircularProgressView.swift
│ ├── ProgressView.swift
│ └── ProgressViewController.swift
├── Styles
│ ├── OrangeClearStyle.swift
│ ├── BlueIndicatorStyle.swift
│ ├── BlueDarkStyle.swift
│ ├── GreenLightStyle.swift
│ └── Style.swift
├── Utils
│ └── ColorUtil.swift
└── GradientCircularProgress.swift
├── .gitignore
├── LICENSE
├── Sample
├── MyStyle.swift
└── BackgroundTransparentStyle.swift
└── README.md
/images/properties.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/keygx/GradientCircularProgress/HEAD/images/properties.png
--------------------------------------------------------------------------------
/images/styles_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/keygx/GradientCircularProgress/HEAD/images/styles_01.png
--------------------------------------------------------------------------------
/images/styles_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/keygx/GradientCircularProgress/HEAD/images/styles_02.png
--------------------------------------------------------------------------------
/images/scr_MyStyle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/keygx/GradientCircularProgress/HEAD/images/scr_MyStyle.png
--------------------------------------------------------------------------------
/images/scr_AddSubViewEx_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/keygx/GradientCircularProgress/HEAD/images/scr_AddSubViewEx_01.png
--------------------------------------------------------------------------------
/images/scr_AddSubViewEx_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/keygx/GradientCircularProgress/HEAD/images/scr_AddSubViewEx_02.png
--------------------------------------------------------------------------------
/images/scr_BlueDarkStyle_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/keygx/GradientCircularProgress/HEAD/images/scr_BlueDarkStyle_01.png
--------------------------------------------------------------------------------
/images/scr_BlueDarkStyle_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/keygx/GradientCircularProgress/HEAD/images/scr_BlueDarkStyle_02.png
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/GradientCircularProgress.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "GradientCircularProgress"
3 | s.version = "3.13.0"
4 | s.summary = "Customizable progress indicator library in Swift"
5 | s.homepage = "https://github.com/keygx/GradientCircularProgress"
6 | s.license = { :type => "MIT", :file => "LICENSE" }
7 | s.author = { "keygx" => "y.kagiyama@gmail.com" }
8 | s.social_media_url = "http://twitter.com/keygx"
9 | s.platform = :ios
10 | s.ios.deployment_target = '8.0'
11 | s.source = { :git => "https://github.com/keygx/GradientCircularProgress.git", :tag => "#{s.version}" }
12 | s.source_files = "source/**/*"
13 | s.requires_arc = true
14 | end
15 |
--------------------------------------------------------------------------------
/source/GradientCircularProgress.h:
--------------------------------------------------------------------------------
1 | //
2 | // GradientCircularProgress.h
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for GradientCircularProgress.
12 | FOUNDATION_EXPORT double GradientCircularProgressVersionNumber;
13 |
14 | //! Project version string for GradientCircularProgress.
15 | FOUNDATION_EXPORT const unsigned char GradientCircularProgressVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/GradientCircularProgress.h:
--------------------------------------------------------------------------------
1 | //
2 | // GradientCircularProgress.h
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for GradientCircularProgress.
12 | FOUNDATION_EXPORT double GradientCircularProgressVersionNumber;
13 |
14 | //! Project version string for GradientCircularProgress.
15 | FOUNDATION_EXPORT const unsigned char GradientCircularProgressVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/AsyncUtil.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AsyncUtil.swift
3 | // GCProgressSample
4 | //
5 | // Created by keygx on 2016/02/20.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import Foundation
10 |
11 | class AsyncUtil {
12 |
13 | func dispatchOnMainThread(_ block: @escaping () -> (), delay: Double) {
14 | if delay == 0 {
15 | DispatchQueue.main.async {
16 | block()
17 | }
18 | return
19 | }
20 |
21 | let d = DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC)
22 | DispatchQueue.main.asyncAfter(deadline: d) {
23 | block()
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by https://www.gitignore.io
2 |
3 | ### Swift ###
4 | # Xcode
5 | #
6 | build/
7 | *.pbxuser
8 | !default.pbxuser
9 | *.mode1v3
10 | !default.mode1v3
11 | *.mode2v3
12 | !default.mode2v3
13 | *.perspectivev3
14 | !default.perspectivev3
15 | xcuserdata
16 | *.xccheckout
17 | *.moved-aside
18 | DerivedData
19 | *.hmap
20 | *.ipa
21 | *.xcuserstate
22 |
23 | # CocoaPods
24 | #
25 | # We recommend against adding the Pods directory to your .gitignore. However
26 | # you should judge for yourself, the pros and cons are mentioned at:
27 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
28 | #
29 | Pods/
30 |
31 | # Carthage
32 | #
33 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
34 | Carthage/Checkouts
35 | Carthage/Build
36 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSampleTests/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 | BNDL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1
23 |
24 |
25 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/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 | FMWK
17 | CFBundleShortVersionString
18 | $(MARKETING_VERSION)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
23 | NSPrincipalClass
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSampleTests/GCProgressSampleTests.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GCProgressSampleTests.swift
3 | // GCProgressSampleTests
4 | //
5 | // Created by keygx on 2015/06/21.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import XCTest
11 |
12 | class GCProgressSampleTests: XCTestCase {
13 |
14 | override func setUp() {
15 | super.setUp()
16 | // Put setup code here. This method is called before the invocation of each test method in the class.
17 | }
18 |
19 | override func tearDown() {
20 | // Put teardown code here. This method is called after the invocation of each test method in the class.
21 | super.tearDown()
22 | }
23 |
24 | func testExample() {
25 | // This is an example of a functional test case.
26 | XCTAssert(true, "Pass")
27 | }
28 |
29 | func testPerformanceExample() {
30 | // This is an example of a performance test case.
31 | self.measure() {
32 | // Put the code you want to measure the time of here.
33 | }
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Yukihiko Kagiyama
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
13 | all 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
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/source/Progress/Elements/WindowBuilder.swift:
--------------------------------------------------------------------------------
1 | //
2 | // WindowBuilder.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2019/09/24.
6 | // Copyright © 2019 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class WindowBuilder {
12 | static func build() -> UIWindow? {
13 | var baseWindow: UIWindow?
14 |
15 | if #available(iOS 13.0, *) {
16 | let windowScene = UIApplication.shared.connectedScenes
17 | .filter { $0.activationState == .foregroundActive }.first
18 | if let windowScene = windowScene as? UIWindowScene {
19 | baseWindow = UIWindow(windowScene: windowScene)
20 | } else {
21 | baseWindow = UIWindow()
22 | }
23 | } else {
24 | baseWindow = UIWindow()
25 | }
26 |
27 | baseWindow?.bounds = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
28 | baseWindow?.backgroundColor = UIColor.clear
29 | baseWindow?.windowLevel = UIWindow.Level.alert + 1
30 | baseWindow?.makeKeyAndVisible()
31 |
32 | return baseWindow
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/source/Styles/OrangeClearStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // OrangeClearStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct OrangeClearStyle: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 80
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 6.0
16 | public var startArcColor: UIColor = UIColor.clear
17 | public var endArcColor: UIColor = UIColor.orange
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = nil
21 | public var baseArcColor: UIColor? = nil
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = UIFont.systemFont(ofSize: 13.0)
25 | public var ratioLabelFontColor: UIColor? = UIColor.black
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = nil
29 | public var messageLabelFontColor: UIColor? = nil
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .none
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/Elements/WindowBuilder.swift:
--------------------------------------------------------------------------------
1 | //
2 | // WindowBuilder.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2019/09/24.
6 | // Copyright © 2019 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class WindowBuilder {
12 | static func build() -> UIWindow? {
13 | var baseWindow: UIWindow?
14 |
15 | if #available(iOS 13.0, *) {
16 | let windowScene = UIApplication.shared.connectedScenes
17 | .filter { $0.activationState == .foregroundActive }.first
18 | if let windowScene = windowScene as? UIWindowScene {
19 | baseWindow = UIWindow(windowScene: windowScene)
20 | } else {
21 | baseWindow = UIWindow()
22 | }
23 | } else {
24 | baseWindow = UIWindow()
25 | }
26 |
27 | baseWindow?.bounds = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height)
28 | baseWindow?.backgroundColor = UIColor.clear
29 | baseWindow?.windowLevel = UIWindow.Level.alert + 1
30 | baseWindow?.makeKeyAndVisible()
31 |
32 | return baseWindow
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Styles/OrangeClearStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // OrangeClearStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct OrangeClearStyle: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 80
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 6.0
16 | public var startArcColor: UIColor = UIColor.clear
17 | public var endArcColor: UIColor = UIColor.orange
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = nil
21 | public var baseArcColor: UIColor? = nil
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = UIFont.systemFont(ofSize: 13.0)
25 | public var ratioLabelFontColor: UIColor? = UIColor.black
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = nil
29 | public var messageLabelFontColor: UIColor? = nil
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .none
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/source/Utils/ColorUtil.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ColorUtil.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/23.
6 | // Copyright © 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class ColorUtil {
12 |
13 | public class func toUIColor(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> UIColor {
14 |
15 | return UIColor(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: a)
16 | }
17 |
18 | internal class func toRGBA(color: UIColor) -> (r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) {
19 | var r: CGFloat = 0.0
20 | var g: CGFloat = 0.0
21 | var b: CGFloat = 0.0
22 | var a: CGFloat = 0.0
23 |
24 | color.getRed(&r, green: &g, blue: &b, alpha: &a)
25 |
26 | return (r, g, b, a)
27 | }
28 |
29 | internal class func toNotOpacityColor(color: UIColor) -> UIColor {
30 |
31 | if color == UIColor.clear {
32 | return UIColor.white
33 | } else {
34 | return UIColor(
35 | red: ColorUtil.toRGBA(color: color).r,
36 | green: ColorUtil.toRGBA(color: color).g,
37 | blue: ColorUtil.toRGBA(color: color).b,
38 | alpha: 1.0)
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Utils/ColorUtil.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ColorUtil.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/23.
6 | // Copyright © 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class ColorUtil {
12 |
13 | public class func toUIColor(r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) -> UIColor {
14 |
15 | return UIColor(red: r/255.0, green: g/255.0, blue: b/255.0, alpha: a)
16 | }
17 |
18 | internal class func toRGBA(color: UIColor) -> (r: CGFloat, g: CGFloat, b: CGFloat, a: CGFloat) {
19 | var r: CGFloat = 0.0
20 | var g: CGFloat = 0.0
21 | var b: CGFloat = 0.0
22 | var a: CGFloat = 0.0
23 |
24 | color.getRed(&r, green: &g, blue: &b, alpha: &a)
25 |
26 | return (r, g, b, a)
27 | }
28 |
29 | internal class func toNotOpacityColor(color: UIColor) -> UIColor {
30 |
31 | if color == UIColor.clear {
32 | return UIColor.white
33 | } else {
34 | return UIColor(
35 | red: ColorUtil.toRGBA(color: color).r,
36 | green: ColorUtil.toRGBA(color: color).g,
37 | blue: ColorUtil.toRGBA(color: color).b,
38 | alpha: 1.0)
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/source/Styles/BlueIndicatorStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BlueIndicatorStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/08/31.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct BlueIndicatorStyle: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 44
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 4.0
16 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 235.0, g: 245.0, b: 255.0, a: 1.0)
17 | public var endArcColor: UIColor = ColorUtil.toUIColor(r: 0.0, g: 122.0, b: 255.0, a: 1.0)
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = 4.0
21 | public var baseArcColor: UIColor? = ColorUtil.toUIColor(r: 215.0, g: 215.0, b: 215.0, a: 0.4)
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = nil
25 | public var ratioLabelFontColor: UIColor? = nil
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = nil
29 | public var messageLabelFontColor: UIColor? = nil
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .none
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/source/Styles/BlueDarkStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BlueDarkStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/08/31.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct BlueDarkStyle: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 260
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 4.0
16 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 0.0, g: 122.0, b: 255.0, a: 1.0)
17 | public var endArcColor: UIColor = UIColor.cyan
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = 5.0
21 | public var baseArcColor: UIColor? = UIColor(red:0.0, green: 0.0, blue: 0.0, alpha: 0.2)
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = UIFont(name: "Verdana-Bold", size: 16.0)
25 | public var ratioLabelFontColor: UIColor? = UIColor.white
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
29 | public var messageLabelFontColor: UIColor? = UIColor.white
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .dark
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Styles/BlueIndicatorStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BlueIndicatorStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/08/31.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct BlueIndicatorStyle: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 44
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 4.0
16 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 235.0, g: 245.0, b: 255.0, a: 1.0)
17 | public var endArcColor: UIColor = ColorUtil.toUIColor(r: 0.0, g: 122.0, b: 255.0, a: 1.0)
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = 4.0
21 | public var baseArcColor: UIColor? = ColorUtil.toUIColor(r: 215.0, g: 215.0, b: 215.0, a: 0.4)
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = nil
25 | public var ratioLabelFontColor: UIColor? = nil
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = nil
29 | public var messageLabelFontColor: UIColor? = nil
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .none
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/source/Styles/GreenLightStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GreenLightStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct GreenLightStyle: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 200
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 32.0
16 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 40.0, g: 110.0, b: 60.0, a: 1.0)
17 | public var endArcColor: UIColor = UIColor.green
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = 1.0
21 | public var baseArcColor: UIColor? = UIColor(red:0.0, green: 0.0, blue: 0.0, alpha: 0.1)
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = UIFont(name: "Verdana-Bold", size: 18.0)
25 | public var ratioLabelFontColor: UIColor? = UIColor.darkGray
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = UIFont(name: "Verdana", size: 18.0)
29 | public var messageLabelFontColor: UIColor? = UIColor.darkGray
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .light
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/source/Styles/Style.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DefaultStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/08/31.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct Style: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 220
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 16.0
16 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 230.0, g: 230.0, b: 230.0, a: 0.6)
17 | public var endArcColor: UIColor = ColorUtil.toUIColor(r: 90.0, g: 90.0, b: 90.0, a: 1.0)
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = 16.0
21 | public var baseArcColor: UIColor? = UIColor(red:1.0, green: 1.0, blue: 1.0, alpha: 0.8)
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = UIFont.systemFont(ofSize: 18.0)
25 | public var ratioLabelFontColor: UIColor? = UIColor.black
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 18.0)
29 | public var messageLabelFontColor: UIColor? = UIColor.black
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .extraLight
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Styles/BlueDarkStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BlueDarkStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/08/31.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct BlueDarkStyle: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 260
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 4.0
16 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 0.0, g: 122.0, b: 255.0, a: 1.0)
17 | public var endArcColor: UIColor = UIColor.cyan
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = 5.0
21 | public var baseArcColor: UIColor? = UIColor(red:0.0, green: 0.0, blue: 0.0, alpha: 0.2)
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = UIFont(name: "Verdana-Bold", size: 16.0)
25 | public var ratioLabelFontColor: UIColor? = UIColor.white
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
29 | public var messageLabelFontColor: UIColor? = UIColor.white
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .dark
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Styles/GreenLightStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GreenLightStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct GreenLightStyle: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 200
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 32.0
16 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 40.0, g: 110.0, b: 60.0, a: 1.0)
17 | public var endArcColor: UIColor = UIColor.green
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = 1.0
21 | public var baseArcColor: UIColor? = UIColor(red:0.0, green: 0.0, blue: 0.0, alpha: 0.1)
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = UIFont(name: "Verdana-Bold", size: 18.0)
25 | public var ratioLabelFontColor: UIColor? = UIColor.darkGray
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = UIFont(name: "Verdana", size: 18.0)
29 | public var messageLabelFontColor: UIColor? = UIColor.darkGray
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .light
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Styles/Style.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DefaultStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/08/31.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 |
10 | public struct Style: StyleProperty {
11 | // Progress Size
12 | public var progressSize: CGFloat = 220
13 |
14 | // Gradient Circular
15 | public var arcLineWidth: CGFloat = 16.0
16 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 230.0, g: 230.0, b: 230.0, a: 0.6)
17 | public var endArcColor: UIColor = ColorUtil.toUIColor(r: 90.0, g: 90.0, b: 90.0, a: 1.0)
18 |
19 | // Base Circular
20 | public var baseLineWidth: CGFloat? = 16.0
21 | public var baseArcColor: UIColor? = UIColor(red:1.0, green: 1.0, blue: 1.0, alpha: 0.8)
22 |
23 | // Ratio
24 | public var ratioLabelFont: UIFont? = UIFont.systemFont(ofSize: 18.0)
25 | public var ratioLabelFontColor: UIColor? = UIColor.black
26 |
27 | // Message
28 | public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 18.0)
29 | public var messageLabelFontColor: UIColor? = UIColor.black
30 |
31 | // Background
32 | public var backgroundStyle: BackgroundStyles = .extraLight
33 |
34 | // Dismiss
35 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
36 |
37 | public init() {}
38 | }
39 |
--------------------------------------------------------------------------------
/Sample/MyStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MyStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/25.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 | import GradientCircularProgress
10 |
11 | public struct MyStyle: StyleProperty {
12 | /*** style properties **********************************************************************************/
13 |
14 | // Progress Size
15 | public var progressSize: CGFloat = 200
16 |
17 | // Gradient Circular
18 | public var arcLineWidth: CGFloat = 18.0
19 | public var startArcColor: UIColor = UIColor.clear
20 | public var endArcColor: UIColor = UIColor.orange
21 |
22 | // Base Circular
23 | public var baseLineWidth: CGFloat? = 19.0
24 | public var baseArcColor: UIColor? = UIColor.darkGray
25 |
26 | // Ratio
27 | public var ratioLabelFont: UIFont? = UIFont(name: "Verdana-Bold", size: 16.0)
28 | public var ratioLabelFontColor: UIColor? = UIColor.white
29 |
30 | // Message
31 | public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
32 | public var messageLabelFontColor: UIColor? = UIColor.white
33 |
34 | // Background
35 | public var backgroundStyle: BackgroundStyles = .dark
36 |
37 | // Dismiss
38 | public var dismissTimeInterval: Double? = 0.0 // 'nil' for default setting.
39 |
40 | /*** style properties **********************************************************************************/
41 |
42 | public init() {}
43 | }
44 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/MyStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MyStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/25.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import GradientCircularProgress
10 |
11 | public struct MyStyle: StyleProperty {
12 | /*** style properties **********************************************************************************/
13 |
14 | // Progress Size
15 | public var progressSize: CGFloat = 200
16 |
17 | // Gradient Circular
18 | public var arcLineWidth: CGFloat = 18.0
19 | public var startArcColor: UIColor = UIColor.clear
20 | public var endArcColor: UIColor = UIColor.orange
21 |
22 | // Base Circular
23 | public var baseLineWidth: CGFloat? = 19.0
24 | public var baseArcColor: UIColor? = UIColor.darkGray
25 |
26 | // Ratio
27 | public var ratioLabelFont: UIFont? = UIFont(name: "Verdana-Bold", size: 16.0)
28 | public var ratioLabelFontColor: UIColor? = UIColor.white
29 |
30 | // Message
31 | public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
32 | public var messageLabelFontColor: UIColor? = UIColor.white
33 |
34 | // Background
35 | public var backgroundStyle: BackgroundStyles = .dark
36 |
37 | // Dismiss
38 | public var dismissTimeInterval: Double? = 0.0 // 'nil' for default setting.
39 |
40 | /*** style properties **********************************************************************************/
41 |
42 | public init() {}
43 | }
44 |
--------------------------------------------------------------------------------
/Sample/BackgroundTransparentStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BackgroundTransparentStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2016/12/03.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 | import UIKit
9 | import GradientCircularProgress
10 |
11 | public struct BackgroundTransparentStyle: StyleProperty {
12 | /*** style properties **********************************************************************************/
13 |
14 | // Progress Size
15 | public var progressSize: CGFloat = 200
16 |
17 | // Gradient Circular
18 | public var arcLineWidth: CGFloat = 4.0
19 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 0.0, g: 122.0, b: 255.0, a: 1.0)
20 | public var endArcColor: UIColor = UIColor.cyan
21 |
22 | // Base Circular
23 | public var baseLineWidth: CGFloat? = 6.0
24 | public var baseArcColor: UIColor? = UIColor(red:0.0, green: 0.0, blue: 0.0, alpha: 0.2)
25 |
26 | // Ratio
27 | public var ratioLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
28 | public var ratioLabelFontColor: UIColor? = UIColor.black
29 |
30 | // Message
31 | public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
32 | public var messageLabelFontColor: UIColor? = UIColor.black
33 |
34 | // Background
35 | public var backgroundStyle: BackgroundStyles = .transparent
36 |
37 | // Dismiss
38 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
39 |
40 | /*** style properties **********************************************************************************/
41 |
42 | public init() {}
43 | }
44 |
--------------------------------------------------------------------------------
/source/Progress/Elements/Background.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Background.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 |
10 | struct Background {
11 |
12 | internal func blurEffectView(fromBlurStyle style: BackgroundStyles, frame: CGRect) -> UIVisualEffectView? {
13 |
14 | var blurView: UIVisualEffectView?
15 |
16 | // return (blurEffectStyle: UIBlurEffectStyle?, isUserInteraction: Bool)
17 | let backgroundStyle = getStyle(style)
18 |
19 | if let blur = backgroundStyle.blurEffectStyle {
20 | // UIBlurEffectStyle (.extraLight, .light, .dark)
21 | let effect = UIBlurEffect(style: blur)
22 | blurView = UIVisualEffectView(effect: effect)
23 |
24 | } else {
25 | if !backgroundStyle.isUserInteraction {
26 | // .transparent
27 | blurView = UIVisualEffectView(effect: nil)
28 | }
29 | }
30 |
31 | blurView?.frame = frame
32 | return blurView
33 | }
34 |
35 | private func getStyle(_ style: BackgroundStyles) -> (blurEffectStyle: UIBlurEffect.Style?, isUserInteraction: Bool) {
36 | switch style {
37 | case .extraLight:
38 | return (.extraLight, false)
39 | case .light:
40 | return (.light, false)
41 | case .dark:
42 | return (.dark, false)
43 | case .transparent:
44 | return (nil, false)
45 | default:
46 | // .none
47 | return (nil, true)
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/BackgroundTransparentStyle.swift:
--------------------------------------------------------------------------------
1 | //
2 | // BackgroundTransparentStyle.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2016/12/03.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import GradientCircularProgress
10 |
11 | public struct BackgroundTransparentStyle: StyleProperty {
12 | /*** style properties **********************************************************************************/
13 |
14 | // Progress Size
15 | public var progressSize: CGFloat = 200
16 |
17 | // Gradient Circular
18 | public var arcLineWidth: CGFloat = 4.0
19 | public var startArcColor: UIColor = ColorUtil.toUIColor(r: 0.0, g: 122.0, b: 255.0, a: 1.0)
20 | public var endArcColor: UIColor = UIColor.cyan
21 |
22 | // Base Circular
23 | public var baseLineWidth: CGFloat? = 6.0
24 | public var baseArcColor: UIColor? = UIColor(red:0.0, green: 0.0, blue: 0.0, alpha: 0.2)
25 |
26 | // Ratio
27 | public var ratioLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
28 | public var ratioLabelFontColor: UIColor? = UIColor.black
29 |
30 | // Message
31 | public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
32 | public var messageLabelFontColor: UIColor? = UIColor.black
33 |
34 | // Background
35 | public var backgroundStyle: BackgroundStyles = .transparent
36 |
37 | // Dismiss
38 | public var dismissTimeInterval: Double? = nil // 'nil' for default setting.
39 |
40 | /*** style properties **********************************************************************************/
41 |
42 | public init() {}
43 | }
44 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/Elements/Background.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Background.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 |
10 | struct Background {
11 |
12 | internal func blurEffectView(fromBlurStyle style: BackgroundStyles, frame: CGRect) -> UIVisualEffectView? {
13 |
14 | var blurView: UIVisualEffectView?
15 |
16 | // return (blurEffectStyle: UIBlurEffectStyle?, isUserInteraction: Bool)
17 | let backgroundStyle = getStyle(style)
18 |
19 | if let blur = backgroundStyle.blurEffectStyle {
20 | // UIBlurEffectStyle (.extraLight, .light, .dark)
21 | let effect = UIBlurEffect(style: blur)
22 | blurView = UIVisualEffectView(effect: effect)
23 |
24 | } else {
25 | if !backgroundStyle.isUserInteraction {
26 | // .transparent
27 | blurView = UIVisualEffectView(effect: nil)
28 | }
29 | }
30 |
31 | blurView?.frame = frame
32 | return blurView
33 | }
34 |
35 | private func getStyle(_ style: BackgroundStyles) -> (blurEffectStyle: UIBlurEffect.Style?, isUserInteraction: Bool) {
36 | switch style {
37 | case .extraLight:
38 | return (.extraLight, false)
39 | case .light:
40 | return (.light, false)
41 | case .dark:
42 | return (.dark, false)
43 | case .transparent:
44 | return (nil, false)
45 | default:
46 | // .none
47 | return (nil, true)
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/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 | $(MARKETING_VERSION)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(CURRENT_PROJECT_VERSION)
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 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/MyButton.swift:
--------------------------------------------------------------------------------
1 | //
2 | // MyButton.swift
3 | // GCProgressSample
4 | //
5 | // Created by keygx on 2016/03/12.
6 | // Copyright © 2016年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 |
12 |
13 | class MyButton: UIButton {
14 |
15 | enum ButtonStatus {
16 | case normal
17 | case highlighted
18 | case selected
19 | case disabled
20 | }
21 |
22 | var status: ButtonStatus = .normal {
23 | didSet {
24 | switch status {
25 | case .disabled:
26 | isEnabled = false
27 | default:
28 | isEnabled = true
29 | }
30 | apply()
31 | }
32 | }
33 |
34 | private let defaultColor: UIColor = UIColor(red: 0.0/255.0, green: 122.0/255.0, blue: 255.0/255.0, alpha: 1.0)
35 | private let disabledColor: UIColor = UIColor.lightGray
36 |
37 | override init(frame: CGRect) {
38 | super.init(frame: frame)
39 |
40 | initialize()
41 | }
42 |
43 | required init?(coder aDecoder: NSCoder) {
44 | super.init(coder: aDecoder)
45 |
46 | initialize()
47 | }
48 |
49 | private func initialize() {
50 | status = .normal
51 |
52 | layer.cornerRadius = 4.0
53 | layer.borderWidth = 1.0
54 | }
55 |
56 | func apply() {
57 | switch status {
58 | case .disabled:
59 | setTitleColor(disabledColor, for: .disabled)
60 | layer.borderColor = disabledColor.cgColor
61 | default:
62 | setTitleColor(defaultColor, for: UIControl.State())
63 | layer.borderColor = defaultColor.cgColor
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/Images.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 | }
--------------------------------------------------------------------------------
/source/Progress/Elements/ArcView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Arc.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ArcView: UIView {
12 |
13 | var prop: Property?
14 | var ratio: CGFloat = 1.0
15 | var color: UIColor = UIColor.black
16 | var lineWidth: CGFloat = 0.0
17 |
18 | required init?(coder aDecoder: NSCoder) {
19 | fatalError("init(coder:) has not been implemented")
20 | }
21 |
22 | init(frame: CGRect, lineWidth: CGFloat) {
23 | super.init(frame: frame)
24 |
25 | backgroundColor = UIColor.clear
26 | layer.masksToBounds = true
27 |
28 | self.lineWidth = lineWidth
29 | }
30 |
31 | override func draw(_ rect: CGRect) {
32 |
33 | drawArc(rect: rect)
34 | }
35 |
36 | private func drawArc(rect: CGRect) {
37 |
38 | guard let prop = prop else {
39 | return
40 | }
41 |
42 | let circularRect: CGRect = prop.progressRect
43 |
44 | let arcPoint: CGPoint = CGPoint(x: rect.width/2, y: rect.height/2)
45 | let arcRadius: CGFloat = circularRect.width/2 + prop.arcLineWidth/2
46 | let arcStartAngle: CGFloat = -CGFloat.pi/2
47 | let arcEndAngle: CGFloat = ratio * 2.0 * CGFloat.pi - CGFloat.pi/2
48 |
49 | let arc: UIBezierPath = UIBezierPath(arcCenter: arcPoint,
50 | radius: arcRadius,
51 | startAngle: arcStartAngle,
52 | endAngle: arcEndAngle,
53 | clockwise: true)
54 |
55 | color.setStroke()
56 |
57 | arc.lineWidth = lineWidth
58 | arc.lineCapStyle = prop.arcLineCapStyle
59 | arc.stroke()
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/Elements/ArcView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Arc.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ArcView: UIView {
12 |
13 | var prop: Property?
14 | var ratio: CGFloat = 1.0
15 | var color: UIColor = UIColor.black
16 | var lineWidth: CGFloat = 0.0
17 |
18 | required init?(coder aDecoder: NSCoder) {
19 | fatalError("init(coder:) has not been implemented")
20 | }
21 |
22 | init(frame: CGRect, lineWidth: CGFloat) {
23 | super.init(frame: frame)
24 |
25 | backgroundColor = UIColor.clear
26 | layer.masksToBounds = true
27 |
28 | self.lineWidth = lineWidth
29 | }
30 |
31 | override func draw(_ rect: CGRect) {
32 |
33 | drawArc(rect: rect)
34 | }
35 |
36 | private func drawArc(rect: CGRect) {
37 |
38 | guard let prop = prop else {
39 | return
40 | }
41 |
42 | let circularRect: CGRect = prop.progressRect
43 |
44 | let arcPoint: CGPoint = CGPoint(x: rect.width/2, y: rect.height/2)
45 | let arcRadius: CGFloat = circularRect.width/2 + prop.arcLineWidth/2
46 | let arcStartAngle: CGFloat = -CGFloat.pi/2
47 | let arcEndAngle: CGFloat = ratio * 2.0 * CGFloat.pi - CGFloat.pi/2
48 |
49 | let arc: UIBezierPath = UIBezierPath(arcCenter: arcPoint,
50 | radius: arcRadius,
51 | startAngle: arcStartAngle,
52 | endAngle: arcEndAngle,
53 | clockwise: true)
54 |
55 | color.setStroke()
56 |
57 | arc.lineWidth = lineWidth
58 | arc.lineCapStyle = prop.arcLineCapStyle
59 | arc.stroke()
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // GCProgressSample
4 | //
5 | // Created by keygx on 2015/06/21.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | private func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> 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 throttle down OpenGL ES frame rates. 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 inactive 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 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/Base.lproj/LaunchScreen.xib:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/source/Progress/Elements/GradientArcView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GradientArcView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class GradientArcView: UIView {
12 |
13 | internal var prop: Property?
14 |
15 | override init(frame: CGRect) {
16 | super.init(frame: frame)
17 |
18 | backgroundColor = UIColor.clear
19 | layer.masksToBounds = true
20 | }
21 |
22 | required init?(coder aDecoder: NSCoder) {
23 | fatalError("init(coder:) has not been implemented")
24 | }
25 |
26 | private func getGradientPointColor(ratio: CGFloat, startColor: UIColor, endColor: UIColor) -> UIColor {
27 |
28 | let sColor = ColorUtil.toRGBA(color: startColor)
29 | let eColor = ColorUtil.toRGBA(color: endColor)
30 |
31 | let r = (eColor.r - sColor.r) * ratio + sColor.r
32 | let g = (eColor.g - sColor.g) * ratio + sColor.g
33 | let b = (eColor.b - sColor.b) * ratio + sColor.b
34 | let a = (eColor.a - sColor.a) * ratio + sColor.a
35 |
36 | return UIColor(red: r, green: g, blue: b, alpha: a)
37 | }
38 |
39 | override func draw(_ rect: CGRect) {
40 |
41 | guard let prop = prop else {
42 | return
43 | }
44 |
45 | let circularRect: CGRect = prop.progressRect
46 |
47 | var currentAngle: CGFloat = 0.0
48 |
49 | for i in stride(from:CGFloat(0.0), through: CGFloat(1.0), by: CGFloat(0.005)) {
50 |
51 | let arcPoint: CGPoint = CGPoint(x: rect.width/2, y: rect.height/2)
52 | let arcRadius: CGFloat = circularRect.width/2 + prop.arcLineWidth/2
53 | let arcStartAngle: CGFloat = -CGFloat.pi/2
54 | let arcEndAngle: CGFloat = i * 2.0 * CGFloat.pi - CGFloat.pi/2
55 |
56 | if currentAngle == 0.0 {
57 | currentAngle = arcStartAngle
58 | } else {
59 | currentAngle = arcEndAngle - 0.05
60 | }
61 |
62 | let arc: UIBezierPath = UIBezierPath(arcCenter: arcPoint,
63 | radius: arcRadius,
64 | startAngle: currentAngle,
65 | endAngle: arcEndAngle,
66 | clockwise: true)
67 |
68 | let strokeColor: UIColor = getGradientPointColor(ratio: i, startColor: prop.startArcColor, endColor: prop.endArcColor)
69 | strokeColor.setStroke()
70 |
71 | arc.lineWidth = prop.arcLineWidth
72 | arc.lineCapStyle = prop.arcLineCapStyle
73 | arc.stroke()
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/Elements/GradientArcView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GradientArcView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class GradientArcView: UIView {
12 |
13 | internal var prop: Property?
14 |
15 | override init(frame: CGRect) {
16 | super.init(frame: frame)
17 |
18 | backgroundColor = UIColor.clear
19 | layer.masksToBounds = true
20 | }
21 |
22 | required init?(coder aDecoder: NSCoder) {
23 | fatalError("init(coder:) has not been implemented")
24 | }
25 |
26 | private func getGradientPointColor(ratio: CGFloat, startColor: UIColor, endColor: UIColor) -> UIColor {
27 |
28 | let sColor = ColorUtil.toRGBA(color: startColor)
29 | let eColor = ColorUtil.toRGBA(color: endColor)
30 |
31 | let r = (eColor.r - sColor.r) * ratio + sColor.r
32 | let g = (eColor.g - sColor.g) * ratio + sColor.g
33 | let b = (eColor.b - sColor.b) * ratio + sColor.b
34 | let a = (eColor.a - sColor.a) * ratio + sColor.a
35 |
36 | return UIColor(red: r, green: g, blue: b, alpha: a)
37 | }
38 |
39 | override func draw(_ rect: CGRect) {
40 |
41 | guard let prop = prop else {
42 | return
43 | }
44 |
45 | let circularRect: CGRect = prop.progressRect
46 |
47 | var currentAngle: CGFloat = 0.0
48 |
49 | for i in stride(from:CGFloat(0.0), through: CGFloat(1.0), by: CGFloat(0.005)) {
50 |
51 | let arcPoint: CGPoint = CGPoint(x: rect.width/2, y: rect.height/2)
52 | let arcRadius: CGFloat = circularRect.width/2 + prop.arcLineWidth/2
53 | let arcStartAngle: CGFloat = -CGFloat.pi/2
54 | let arcEndAngle: CGFloat = i * 2.0 * CGFloat.pi - CGFloat.pi/2
55 |
56 | if currentAngle == 0.0 {
57 | currentAngle = arcStartAngle
58 | } else {
59 | currentAngle = arcEndAngle - 0.05
60 | }
61 |
62 | let arc: UIBezierPath = UIBezierPath(arcCenter: arcPoint,
63 | radius: arcRadius,
64 | startAngle: currentAngle,
65 | endAngle: arcEndAngle,
66 | clockwise: true)
67 |
68 | let strokeColor: UIColor = getGradientPointColor(ratio: i, startColor: prop.startArcColor, endColor: prop.endArcColor)
69 | strokeColor.setStroke()
70 |
71 | arc.lineWidth = prop.arcLineWidth
72 | arc.lineCapStyle = prop.arcLineCapStyle
73 | arc.stroke()
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample.xcodeproj/xcshareddata/xcschemes/GradientCircularProgress.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
43 |
44 |
50 |
51 |
52 |
53 |
59 |
60 |
66 |
67 |
68 |
69 |
71 |
72 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/source/Progress/Property.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Property.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | public protocol StyleProperty {
10 | // Progress Size
11 | var progressSize: CGFloat { get set }
12 |
13 | // Gradient Circular
14 | var arcLineWidth: CGFloat { get set }
15 | var startArcColor: UIColor { get set }
16 | var endArcColor: UIColor { get set }
17 |
18 | // Base Circular
19 | var baseLineWidth: CGFloat? { get set }
20 | var baseArcColor: UIColor? { get set }
21 |
22 | // Ratio
23 | var ratioLabelFont: UIFont? { get set }
24 | var ratioLabelFontColor: UIColor? { get set }
25 |
26 | // Message
27 | var messageLabelFont: UIFont? { get set }
28 | var messageLabelFontColor: UIColor? { get set }
29 |
30 | // Background
31 | var backgroundStyle: BackgroundStyles { get set }
32 |
33 | // Dismiss
34 | var dismissTimeInterval: Double? { get set }
35 |
36 | // Initialize
37 | init()
38 | }
39 |
40 | public enum BackgroundStyles: Int {
41 | case none = 0
42 | case extraLight
43 | case light
44 | case dark
45 | case transparent
46 | }
47 |
48 |
49 | internal struct Property {
50 | let margin: CGFloat = 5.0
51 | let arcLineCapStyle: CGLineCap = CGLineCap.butt
52 |
53 | // Progress Size
54 | var progressSize: CGFloat
55 |
56 | // Gradient Circular
57 | var arcLineWidth: CGFloat
58 | var startArcColor: UIColor
59 | var endArcColor: UIColor
60 |
61 | // Base Circular
62 | var baseLineWidth: CGFloat?
63 | var baseArcColor: UIColor?
64 |
65 | // Ratio
66 | let ratioLabelFont: UIFont?
67 | let ratioLabelFontColor: UIColor?
68 |
69 | // Message
70 | let messageLabelFont: UIFont?
71 | let messageLabelFontColor: UIColor?
72 |
73 | // Background
74 | let backgroundStyle: BackgroundStyles
75 |
76 | // Dismiss
77 | let dismissTimeInterval: Double?
78 |
79 | // Progress Rect
80 | var progressRect: CGRect {
81 | let lineWidth: CGFloat = (arcLineWidth > baseLineWidth!) ? arcLineWidth : baseLineWidth!
82 | return CGRect(x: 0, y: 0, width: progressSize - lineWidth * 2, height: progressSize - lineWidth * 2)
83 | }
84 |
85 | init(style: StyleProperty) {
86 |
87 | let styles: StyleProperty = style
88 |
89 | progressSize = styles.progressSize
90 | arcLineWidth = styles.arcLineWidth
91 | startArcColor = styles.startArcColor
92 | endArcColor = styles.endArcColor
93 | baseLineWidth = styles.baseLineWidth ?? 0.0
94 | baseArcColor = styles.baseArcColor ?? UIColor.clear
95 | ratioLabelFont = styles.ratioLabelFont ?? UIFont.systemFont(ofSize: 16.0)
96 | ratioLabelFontColor = styles.ratioLabelFontColor ?? UIColor.clear
97 | messageLabelFont = styles.messageLabelFont ?? UIFont.systemFont(ofSize: 16.0)
98 | messageLabelFontColor = styles.messageLabelFontColor ?? UIColor.clear
99 | backgroundStyle = styles.backgroundStyle
100 | dismissTimeInterval = styles.dismissTimeInterval ?? 0.8
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/Property.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Property.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | public protocol StyleProperty {
10 | // Progress Size
11 | var progressSize: CGFloat { get set }
12 |
13 | // Gradient Circular
14 | var arcLineWidth: CGFloat { get set }
15 | var startArcColor: UIColor { get set }
16 | var endArcColor: UIColor { get set }
17 |
18 | // Base Circular
19 | var baseLineWidth: CGFloat? { get set }
20 | var baseArcColor: UIColor? { get set }
21 |
22 | // Ratio
23 | var ratioLabelFont: UIFont? { get set }
24 | var ratioLabelFontColor: UIColor? { get set }
25 |
26 | // Message
27 | var messageLabelFont: UIFont? { get set }
28 | var messageLabelFontColor: UIColor? { get set }
29 |
30 | // Background
31 | var backgroundStyle: BackgroundStyles { get set }
32 |
33 | // Dismiss
34 | var dismissTimeInterval: Double? { get set }
35 |
36 | // Initialize
37 | init()
38 | }
39 |
40 | public enum BackgroundStyles: Int {
41 | case none = 0
42 | case extraLight
43 | case light
44 | case dark
45 | case transparent
46 | }
47 |
48 |
49 | internal struct Property {
50 | let margin: CGFloat = 5.0
51 | let arcLineCapStyle: CGLineCap = CGLineCap.butt
52 |
53 | // Progress Size
54 | var progressSize: CGFloat
55 |
56 | // Gradient Circular
57 | var arcLineWidth: CGFloat
58 | var startArcColor: UIColor
59 | var endArcColor: UIColor
60 |
61 | // Base Circular
62 | var baseLineWidth: CGFloat?
63 | var baseArcColor: UIColor?
64 |
65 | // Ratio
66 | let ratioLabelFont: UIFont?
67 | let ratioLabelFontColor: UIColor?
68 |
69 | // Message
70 | let messageLabelFont: UIFont?
71 | let messageLabelFontColor: UIColor?
72 |
73 | // Background
74 | let backgroundStyle: BackgroundStyles
75 |
76 | // Dismiss
77 | let dismissTimeInterval: Double?
78 |
79 | // Progress Rect
80 | var progressRect: CGRect {
81 | let lineWidth: CGFloat = (arcLineWidth > baseLineWidth!) ? arcLineWidth : baseLineWidth!
82 | return CGRect(x: 0, y: 0, width: progressSize - lineWidth * 2, height: progressSize - lineWidth * 2)
83 | }
84 |
85 | init(style: StyleProperty) {
86 |
87 | let styles: StyleProperty = style
88 |
89 | progressSize = styles.progressSize
90 | arcLineWidth = styles.arcLineWidth
91 | startArcColor = styles.startArcColor
92 | endArcColor = styles.endArcColor
93 | baseLineWidth = styles.baseLineWidth ?? 0.0
94 | baseArcColor = styles.baseArcColor ?? UIColor.clear
95 | ratioLabelFont = styles.ratioLabelFont ?? UIFont.systemFont(ofSize: 16.0)
96 | ratioLabelFontColor = styles.ratioLabelFontColor ?? UIColor.clear
97 | messageLabelFont = styles.messageLabelFont ?? UIFont.systemFont(ofSize: 16.0)
98 | messageLabelFontColor = styles.messageLabelFontColor ?? UIColor.clear
99 | backgroundStyle = styles.backgroundStyle
100 | dismissTimeInterval = styles.dismissTimeInterval ?? 0.8
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/source/Progress/Core/ProgressAtRatioView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ProgressAtRatioView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ProgressAtRatioView: UIView {
12 |
13 | internal var arcView: ArcView?
14 | internal var prop: Property?
15 | internal var ratioLabel: UILabel = UILabel()
16 |
17 | internal var ratio: CGFloat = 0.0 {
18 | didSet {
19 | ratioLabel.text = String(format:"%.0f", ratio * 100) + "%"
20 | }
21 | }
22 |
23 | override init(frame: CGRect) {
24 | super.init(frame: frame)
25 |
26 | backgroundColor = UIColor.clear
27 | layer.masksToBounds = true
28 | }
29 |
30 | required init?(coder aDecoder: NSCoder) {
31 | fatalError("init(coder:) has not been implemented")
32 | }
33 |
34 | internal func initialize(frame: CGRect) {
35 |
36 | guard let prop = prop else {
37 | return
38 | }
39 |
40 | let rect: CGRect = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)
41 |
42 | // Base Circular
43 | if let baseLineWidth = prop.baseLineWidth, let baseArcColor = prop.baseArcColor {
44 | let circular: ArcView = ArcView(frame: rect, lineWidth: baseLineWidth)
45 | circular.prop = prop
46 | circular.ratio = 1.0
47 | circular.color = baseArcColor
48 | circular.lineWidth = baseLineWidth
49 | addSubview(circular)
50 | }
51 |
52 | // Gradient Circular
53 | if ColorUtil.toRGBA(color: prop.startArcColor).a < 1.0 || ColorUtil.toRGBA(color: prop.endArcColor).a < 1.0 {
54 | // Clear Color
55 | let gradient: UIView = GradientArcWithClearColorView().draw(rect: rect, prop: prop)
56 | addSubview(gradient)
57 |
58 | masking(rect: rect, prop: prop, gradient: gradient)
59 |
60 | } else {
61 | // Opaque Color
62 | let gradient: GradientArcView = GradientArcView(frame: rect)
63 | gradient.prop = prop
64 | addSubview(gradient)
65 |
66 | masking(rect: rect, prop: prop, gradient: gradient)
67 | }
68 | }
69 |
70 | private func masking(rect: CGRect, prop: Property, gradient: UIView) {
71 | // Mask
72 | arcView = ArcView(frame: rect, lineWidth: prop.arcLineWidth)
73 |
74 | guard let mask = arcView else {
75 | return
76 | }
77 |
78 | mask.prop = prop
79 | gradient.layer.mask = mask.layer
80 | }
81 |
82 | override func draw(_ rect: CGRect) {
83 |
84 | guard let mask = arcView else {
85 | return
86 | }
87 |
88 | if ratio > 1.0 {
89 | mask.ratio = 1.0
90 | } else {
91 | mask.ratio = ratio
92 | }
93 | mask.setNeedsDisplay()
94 | }
95 |
96 | func showRatio() {
97 |
98 | guard let prop = prop else {
99 | return
100 | }
101 |
102 | // Progress Ratio
103 | ratioLabel.text = " "
104 | ratioLabel.font = prop.ratioLabelFont
105 | ratioLabel.textAlignment = NSTextAlignment.right
106 | ratioLabel.textColor = prop.ratioLabelFontColor
107 | ratioLabel.sizeToFit()
108 | ratioLabel.center = center
109 |
110 | addSubview(ratioLabel)
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/Core/ProgressAtRatioView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ProgressAtRatioView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ProgressAtRatioView: UIView {
12 |
13 | internal var arcView: ArcView?
14 | internal var prop: Property?
15 | internal var ratioLabel: UILabel = UILabel()
16 |
17 | internal var ratio: CGFloat = 0.0 {
18 | didSet {
19 | ratioLabel.text = String(format:"%.0f", ratio * 100) + "%"
20 | }
21 | }
22 |
23 | override init(frame: CGRect) {
24 | super.init(frame: frame)
25 |
26 | backgroundColor = UIColor.clear
27 | layer.masksToBounds = true
28 | }
29 |
30 | required init?(coder aDecoder: NSCoder) {
31 | fatalError("init(coder:) has not been implemented")
32 | }
33 |
34 | internal func initialize(frame: CGRect) {
35 |
36 | guard let prop = prop else {
37 | return
38 | }
39 |
40 | let rect: CGRect = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)
41 |
42 | // Base Circular
43 | if let baseLineWidth = prop.baseLineWidth, let baseArcColor = prop.baseArcColor {
44 | let circular: ArcView = ArcView(frame: rect, lineWidth: baseLineWidth)
45 | circular.prop = prop
46 | circular.ratio = 1.0
47 | circular.color = baseArcColor
48 | circular.lineWidth = baseLineWidth
49 | addSubview(circular)
50 | }
51 |
52 | // Gradient Circular
53 | if ColorUtil.toRGBA(color: prop.startArcColor).a < 1.0 || ColorUtil.toRGBA(color: prop.endArcColor).a < 1.0 {
54 | // Clear Color
55 | let gradient: UIView = GradientArcWithClearColorView().draw(rect: rect, prop: prop)
56 | addSubview(gradient)
57 |
58 | masking(rect: rect, prop: prop, gradient: gradient)
59 |
60 | } else {
61 | // Opaque Color
62 | let gradient: GradientArcView = GradientArcView(frame: rect)
63 | gradient.prop = prop
64 | addSubview(gradient)
65 |
66 | masking(rect: rect, prop: prop, gradient: gradient)
67 | }
68 | }
69 |
70 | private func masking(rect: CGRect, prop: Property, gradient: UIView) {
71 | // Mask
72 | arcView = ArcView(frame: rect, lineWidth: prop.arcLineWidth)
73 |
74 | guard let mask = arcView else {
75 | return
76 | }
77 |
78 | mask.prop = prop
79 | gradient.layer.mask = mask.layer
80 | }
81 |
82 | override func draw(_ rect: CGRect) {
83 |
84 | guard let mask = arcView else {
85 | return
86 | }
87 |
88 | if ratio > 1.0 {
89 | mask.ratio = 1.0
90 | } else {
91 | mask.ratio = ratio
92 | }
93 | mask.setNeedsDisplay()
94 | }
95 |
96 | func showRatio() {
97 |
98 | guard let prop = prop else {
99 | return
100 | }
101 |
102 | // Progress Ratio
103 | ratioLabel.text = " "
104 | ratioLabel.font = prop.ratioLabelFont
105 | ratioLabel.textAlignment = NSTextAlignment.right
106 | ratioLabel.textColor = prop.ratioLabelFontColor
107 | ratioLabel.sizeToFit()
108 | ratioLabel.center = center
109 |
110 | addSubview(ratioLabel)
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/source/Progress/ProgressView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ProgressView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2016/03/07.
6 | // Copyright (c) 2016年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ProgressView: UIView {
12 |
13 | private var viewRect: CGRect?
14 | private var blurView: UIVisualEffectView?
15 | private var progressAtRatioView: ProgressAtRatioView?
16 | private var circularProgressView: CircularProgressView?
17 | internal var prop: Property?
18 |
19 | internal var ratio: CGFloat = 0.0 {
20 | didSet {
21 | progressAtRatioView?.ratio = ratio
22 | progressAtRatioView?.setNeedsDisplay()
23 | }
24 | }
25 |
26 | override init(frame: CGRect) {
27 | super.init(frame: frame)
28 |
29 | initialize(frame: frame)
30 | }
31 |
32 | required init(coder aDecoder: NSCoder) {
33 | super.init(coder: aDecoder)!
34 | }
35 |
36 | private func initialize(frame: CGRect) {
37 | viewRect = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)
38 | clipsToBounds = true
39 | }
40 |
41 | internal func arc(_ display: Bool, style: StyleProperty) {
42 |
43 | prop = Property(style: style)
44 |
45 | guard let prop = prop else {
46 | return
47 | }
48 |
49 | isUserInteractionEnabled = !(prop.backgroundStyle.rawValue == 0) ? true : false
50 |
51 | getBlurView()
52 |
53 | progressAtRatioView = ProgressAtRatioView(frame: CGRect(x: 0, y: 0, width: prop.progressSize, height: prop.progressSize))
54 |
55 | guard let progressAtRatioView = progressAtRatioView else {
56 | return
57 | }
58 |
59 | progressAtRatioView.prop = prop
60 | progressAtRatioView.initialize(frame: progressAtRatioView.frame)
61 |
62 | if display {
63 | progressAtRatioView.showRatio()
64 | }
65 |
66 | progressAtRatioView.frame = CGRect(
67 | x: (frame.size.width - progressAtRatioView.frame.size.width) / 2,
68 | y: (frame.size.height - progressAtRatioView.frame.size.height) / 2,
69 | width: progressAtRatioView.frame.size.width,
70 | height: progressAtRatioView.frame.size.height)
71 |
72 | addSubview(progressAtRatioView)
73 | }
74 |
75 | internal func circle(_ message: String?, style: StyleProperty) {
76 |
77 | prop = Property(style: style)
78 |
79 | guard let prop = prop else {
80 | return
81 | }
82 |
83 | isUserInteractionEnabled = !(prop.backgroundStyle.rawValue == 0) ? true : false
84 |
85 | getBlurView()
86 |
87 | circularProgressView = CircularProgressView(frame: CGRect(x: 0, y: 0, width: prop.progressSize, height: prop.progressSize))
88 |
89 | guard let circularProgressView = circularProgressView else {
90 | return
91 | }
92 |
93 | circularProgressView.prop = prop
94 | circularProgressView.initialize(frame: circularProgressView.frame)
95 |
96 | if let message = message {
97 | circularProgressView.showMessage(message)
98 | }
99 |
100 | circularProgressView.frame = CGRect(
101 | x: (frame.size.width - circularProgressView.frame.size.width) / 2,
102 | y: (frame.size.height - circularProgressView.frame.size.height) / 2,
103 | width: circularProgressView.frame.size.width,
104 | height: circularProgressView.frame.size.height)
105 |
106 | addSubview(circularProgressView)
107 | }
108 |
109 | internal func updateMessage(_ message: String) {
110 |
111 | guard let circularProgressView = circularProgressView else {
112 | return
113 | }
114 |
115 | circularProgressView.message = message
116 | }
117 |
118 | private func getBlurView() {
119 |
120 | guard let rect = viewRect, let prop = prop else {
121 | return
122 | }
123 |
124 | blurView = Background().blurEffectView(fromBlurStyle: prop.backgroundStyle, frame: rect)
125 |
126 | guard let blurView = blurView else {
127 | return
128 | }
129 |
130 | backgroundColor = UIColor.clear
131 | addSubview(blurView)
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/ProgressView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ProgressView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2016/03/07.
6 | // Copyright (c) 2016年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ProgressView: UIView {
12 |
13 | private var viewRect: CGRect?
14 | private var blurView: UIVisualEffectView?
15 | private var progressAtRatioView: ProgressAtRatioView?
16 | private var circularProgressView: CircularProgressView?
17 | internal var prop: Property?
18 |
19 | internal var ratio: CGFloat = 0.0 {
20 | didSet {
21 | progressAtRatioView?.ratio = ratio
22 | progressAtRatioView?.setNeedsDisplay()
23 | }
24 | }
25 |
26 | override init(frame: CGRect) {
27 | super.init(frame: frame)
28 |
29 | initialize(frame: frame)
30 | }
31 |
32 | required init(coder aDecoder: NSCoder) {
33 | super.init(coder: aDecoder)!
34 | }
35 |
36 | private func initialize(frame: CGRect) {
37 | viewRect = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)
38 | clipsToBounds = true
39 | }
40 |
41 | internal func arc(_ display: Bool, style: StyleProperty) {
42 |
43 | prop = Property(style: style)
44 |
45 | guard let prop = prop else {
46 | return
47 | }
48 |
49 | isUserInteractionEnabled = !(prop.backgroundStyle.rawValue == 0) ? true : false
50 |
51 | getBlurView()
52 |
53 | progressAtRatioView = ProgressAtRatioView(frame: CGRect(x: 0, y: 0, width: prop.progressSize, height: prop.progressSize))
54 |
55 | guard let progressAtRatioView = progressAtRatioView else {
56 | return
57 | }
58 |
59 | progressAtRatioView.prop = prop
60 | progressAtRatioView.initialize(frame: progressAtRatioView.frame)
61 |
62 | if display {
63 | progressAtRatioView.showRatio()
64 | }
65 |
66 | progressAtRatioView.frame = CGRect(
67 | x: (frame.size.width - progressAtRatioView.frame.size.width) / 2,
68 | y: (frame.size.height - progressAtRatioView.frame.size.height) / 2,
69 | width: progressAtRatioView.frame.size.width,
70 | height: progressAtRatioView.frame.size.height)
71 |
72 | addSubview(progressAtRatioView)
73 | }
74 |
75 | internal func circle(_ message: String?, style: StyleProperty) {
76 |
77 | prop = Property(style: style)
78 |
79 | guard let prop = prop else {
80 | return
81 | }
82 |
83 | isUserInteractionEnabled = !(prop.backgroundStyle.rawValue == 0) ? true : false
84 |
85 | getBlurView()
86 |
87 | circularProgressView = CircularProgressView(frame: CGRect(x: 0, y: 0, width: prop.progressSize, height: prop.progressSize))
88 |
89 | guard let circularProgressView = circularProgressView else {
90 | return
91 | }
92 |
93 | circularProgressView.prop = prop
94 | circularProgressView.initialize(frame: circularProgressView.frame)
95 |
96 | if let message = message {
97 | circularProgressView.showMessage(message)
98 | }
99 |
100 | circularProgressView.frame = CGRect(
101 | x: (frame.size.width - circularProgressView.frame.size.width) / 2,
102 | y: (frame.size.height - circularProgressView.frame.size.height) / 2,
103 | width: circularProgressView.frame.size.width,
104 | height: circularProgressView.frame.size.height)
105 |
106 | addSubview(circularProgressView)
107 | }
108 |
109 | internal func updateMessage(_ message: String) {
110 |
111 | guard let circularProgressView = circularProgressView else {
112 | return
113 | }
114 |
115 | circularProgressView.message = message
116 | }
117 |
118 | private func getBlurView() {
119 |
120 | guard let rect = viewRect, let prop = prop else {
121 | return
122 | }
123 |
124 | blurView = Background().blurEffectView(fromBlurStyle: prop.backgroundStyle, frame: rect)
125 |
126 | guard let blurView = blurView else {
127 | return
128 | }
129 |
130 | backgroundColor = UIColor.clear
131 | addSubview(blurView)
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/source/Progress/Core/CircularProgressView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CircularProgressView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class CircularProgressView: UIView {
12 |
13 | var prop: Property?
14 | var messageLabel = UILabel()
15 | var centerPoint: CGPoint?
16 |
17 | var message: String? {
18 | willSet {
19 | messageLabel.frame = frame
20 | messageLabel.text = newValue
21 |
22 | guard let message = messageLabel.text else {
23 | return
24 | }
25 |
26 | // Attribute
27 | let paragraphStyle = NSMutableParagraphStyle()
28 | paragraphStyle.lineHeightMultiple = 1.2
29 | paragraphStyle.alignment = NSTextAlignment.center
30 | let attr = [NSAttributedString.Key.paragraphStyle: paragraphStyle]
31 | let attributedString = NSMutableAttributedString(string: message, attributes: attr)
32 |
33 | messageLabel.attributedText = attributedString
34 | messageLabel.sizeToFit()
35 |
36 | if centerPoint == nil {
37 | centerPoint = center
38 | }
39 |
40 | if let center = centerPoint {
41 | messageLabel.center = center
42 | }
43 | }
44 | }
45 |
46 | var gradientLayer = CALayer()
47 |
48 | private struct Animation {
49 | var rotationZ: CABasicAnimation {
50 | let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
51 | animation.duration = 0.8
52 | animation.repeatCount = HUGE
53 | animation.fromValue = NSNumber(value: 0.0)
54 | animation.toValue = NSNumber(value: 2 * Float.pi)
55 |
56 | return animation
57 | }
58 |
59 | init() {}
60 |
61 | func start(_ layer: CALayer) {
62 | layer.add(rotationZ, forKey: "rotate")
63 | }
64 |
65 | func stop(_ layer: CALayer) {
66 | layer.removeAllAnimations()
67 | }
68 | }
69 |
70 | override init(frame: CGRect) {
71 | super.init(frame: frame)
72 |
73 | backgroundColor = UIColor.clear
74 | layer.masksToBounds = true
75 |
76 | NotificationCenter.default.addObserver(self,
77 | selector: #selector(viewDidEnterBackground(_:)),
78 | name: UIApplication.didEnterBackgroundNotification,
79 | object: nil)
80 | NotificationCenter.default.addObserver(self,
81 | selector: #selector(viewWillEnterForeground(_:)),
82 | name: UIApplication.willEnterForegroundNotification,
83 | object: nil)
84 | }
85 |
86 | required init?(coder aDecoder: NSCoder) {
87 | fatalError("init(coder:) has not been implemented")
88 | }
89 |
90 | deinit {
91 | NotificationCenter.default.removeObserver(self)
92 | }
93 |
94 | override func didMoveToWindow() {
95 | super.didMoveToWindow()
96 | if window != nil {
97 | Animation().start(gradientLayer)
98 | } else {
99 | Animation().stop(gradientLayer)
100 | }
101 | }
102 |
103 | @objc private func viewDidEnterBackground(_ notification: Notification?) {
104 | Animation().stop(gradientLayer)
105 | }
106 |
107 | @objc private func viewWillEnterForeground(_ notification: Notification?) {
108 | Animation().start(gradientLayer)
109 | }
110 |
111 | internal func initialize(frame: CGRect) {
112 |
113 | guard let prop = prop else {
114 | return
115 | }
116 |
117 | let rect: CGRect = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)
118 |
119 | // Base Circular
120 | if let baseLineWidth = prop.baseLineWidth, let baseArcColor = prop.baseArcColor {
121 | let circular: ArcView = ArcView(frame: rect, lineWidth: baseLineWidth)
122 | circular.color = baseArcColor
123 | circular.prop = prop
124 | addSubview(circular)
125 | }
126 |
127 | // Gradient Circular
128 | if ColorUtil.toRGBA(color: prop.startArcColor).a < 1.0 || ColorUtil.toRGBA(color: prop.endArcColor).a < 1.0 {
129 | // Clear Color
130 | let gradient: UIView = GradientArcWithClearColorView().draw(rect: rect, prop: prop)
131 | addSubview(gradient)
132 |
133 | gradientLayer = gradient.layer
134 | Animation().start(gradientLayer)
135 |
136 | } else {
137 | // Opaque Color
138 | let gradient: GradientArcView = GradientArcView(frame: rect)
139 | gradient.prop = prop
140 | addSubview(gradient)
141 |
142 | gradientLayer = gradient.layer
143 | Animation().start(gradientLayer)
144 | }
145 | }
146 |
147 | internal func showMessage(_ message: String) {
148 |
149 | guard let prop = prop else {
150 | return
151 | }
152 |
153 | // Message
154 | messageLabel.font = prop.messageLabelFont
155 | messageLabel.textAlignment = NSTextAlignment.center
156 | messageLabel.textColor = prop.messageLabelFontColor
157 | messageLabel.numberOfLines = 0
158 |
159 | addSubview(messageLabel)
160 |
161 | self.message = message
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/Core/CircularProgressView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // CircularProgressView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class CircularProgressView: UIView {
12 |
13 | var prop: Property?
14 | var messageLabel = UILabel()
15 | var centerPoint: CGPoint?
16 |
17 | var message: String? {
18 | willSet {
19 | messageLabel.frame = frame
20 | messageLabel.text = newValue
21 |
22 | guard let message = messageLabel.text else {
23 | return
24 | }
25 |
26 | // Attribute
27 | let paragraphStyle = NSMutableParagraphStyle()
28 | paragraphStyle.lineHeightMultiple = 1.2
29 | paragraphStyle.alignment = NSTextAlignment.center
30 | let attr = [NSAttributedString.Key.paragraphStyle: paragraphStyle]
31 | let attributedString = NSMutableAttributedString(string: message, attributes: attr)
32 |
33 | messageLabel.attributedText = attributedString
34 | messageLabel.sizeToFit()
35 |
36 | if centerPoint == nil {
37 | centerPoint = center
38 | }
39 |
40 | if let center = centerPoint {
41 | messageLabel.center = center
42 | }
43 | }
44 | }
45 |
46 | var gradientLayer = CALayer()
47 |
48 | private struct Animation {
49 | var rotationZ: CABasicAnimation {
50 | let animation: CABasicAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
51 | animation.duration = 0.8
52 | animation.repeatCount = HUGE
53 | animation.fromValue = NSNumber(value: 0.0)
54 | animation.toValue = NSNumber(value: 2 * Float.pi)
55 |
56 | return animation
57 | }
58 |
59 | init() {}
60 |
61 | func start(_ layer: CALayer) {
62 | layer.add(rotationZ, forKey: "rotate")
63 | }
64 |
65 | func stop(_ layer: CALayer) {
66 | layer.removeAllAnimations()
67 | }
68 | }
69 |
70 | override init(frame: CGRect) {
71 | super.init(frame: frame)
72 |
73 | backgroundColor = UIColor.clear
74 | layer.masksToBounds = true
75 |
76 | NotificationCenter.default.addObserver(self,
77 | selector: #selector(viewDidEnterBackground(_:)),
78 | name: UIApplication.didEnterBackgroundNotification,
79 | object: nil)
80 | NotificationCenter.default.addObserver(self,
81 | selector: #selector(viewWillEnterForeground(_:)),
82 | name: UIApplication.willEnterForegroundNotification,
83 | object: nil)
84 | }
85 |
86 | required init?(coder aDecoder: NSCoder) {
87 | fatalError("init(coder:) has not been implemented")
88 | }
89 |
90 | deinit {
91 | NotificationCenter.default.removeObserver(self)
92 | }
93 |
94 | override func didMoveToWindow() {
95 | super.didMoveToWindow()
96 | if window != nil {
97 | Animation().start(gradientLayer)
98 | } else {
99 | Animation().stop(gradientLayer)
100 | }
101 | }
102 |
103 | @objc private func viewDidEnterBackground(_ notification: Notification?) {
104 | Animation().stop(gradientLayer)
105 | }
106 |
107 | @objc private func viewWillEnterForeground(_ notification: Notification?) {
108 | Animation().start(gradientLayer)
109 | }
110 |
111 | internal func initialize(frame: CGRect) {
112 |
113 | guard let prop = prop else {
114 | return
115 | }
116 |
117 | let rect: CGRect = CGRect(x: 0, y: 0, width: frame.size.width, height: frame.size.height)
118 |
119 | // Base Circular
120 | if let baseLineWidth = prop.baseLineWidth, let baseArcColor = prop.baseArcColor {
121 | let circular: ArcView = ArcView(frame: rect, lineWidth: baseLineWidth)
122 | circular.color = baseArcColor
123 | circular.prop = prop
124 | addSubview(circular)
125 | }
126 |
127 | // Gradient Circular
128 | if ColorUtil.toRGBA(color: prop.startArcColor).a < 1.0 || ColorUtil.toRGBA(color: prop.endArcColor).a < 1.0 {
129 | // Clear Color
130 | let gradient: UIView = GradientArcWithClearColorView().draw(rect: rect, prop: prop)
131 | addSubview(gradient)
132 |
133 | gradientLayer = gradient.layer
134 | Animation().start(gradientLayer)
135 |
136 | } else {
137 | // Opaque Color
138 | let gradient: GradientArcView = GradientArcView(frame: rect)
139 | gradient.prop = prop
140 | addSubview(gradient)
141 |
142 | gradientLayer = gradient.layer
143 | Animation().start(gradientLayer)
144 | }
145 | }
146 |
147 | internal func showMessage(_ message: String) {
148 |
149 | guard let prop = prop else {
150 | return
151 | }
152 |
153 | // Message
154 | messageLabel.font = prop.messageLabelFont
155 | messageLabel.textAlignment = NSTextAlignment.center
156 | messageLabel.textColor = prop.messageLabelFontColor
157 | messageLabel.numberOfLines = 0
158 |
159 | addSubview(messageLabel)
160 |
161 | self.message = message
162 | }
163 | }
164 |
--------------------------------------------------------------------------------
/source/Progress/ProgressViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ProgressViewController.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ProgressViewController: UIViewController {
12 |
13 | private var viewRect: CGRect?
14 | private var blurView: UIVisualEffectView?
15 | private var progressAtRatioView: ProgressAtRatioView?
16 | private var circularProgressView: CircularProgressView?
17 | internal var prop: Property?
18 |
19 | internal var ratio: CGFloat = 0.0 {
20 | didSet {
21 | progressAtRatioView?.ratio = ratio
22 | progressAtRatioView?.setNeedsDisplay()
23 | }
24 | }
25 |
26 | override func viewDidLoad() {
27 | super.viewDidLoad()
28 |
29 | view.backgroundColor = UIColor.clear
30 | }
31 |
32 | override func didReceiveMemoryWarning() {
33 | super.didReceiveMemoryWarning()
34 | }
35 |
36 | override var shouldAutorotate: Bool {
37 | return false
38 | }
39 |
40 | override var prefersStatusBarHidden: Bool {
41 | let orientation: UIInterfaceOrientation
42 | if #available(iOS 13.0, *) {
43 | orientation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation ?? .portrait
44 | } else {
45 | orientation = UIApplication.shared.statusBarOrientation
46 | }
47 |
48 | switch orientation {
49 | case .landscapeLeft, .landscapeRight:
50 | // LandscapeLeft | LandscapeRight
51 | return true
52 | default:
53 | // Unknown | Portrait | PortraitUpsideDown
54 | return false
55 | }
56 | }
57 |
58 | private func getViewRect() {
59 |
60 | let window = UIWindow(frame: UIScreen.main.bounds)
61 |
62 | viewRect = window.frame
63 | }
64 |
65 | private func getBlurView() {
66 |
67 | guard let rect = viewRect, let prop = prop else {
68 | return
69 | }
70 |
71 | blurView = Background().blurEffectView(fromBlurStyle: prop.backgroundStyle, frame: rect)
72 |
73 | guard let blurView = blurView else {
74 | return
75 | }
76 |
77 | view.backgroundColor = UIColor.clear
78 | view.addSubview(blurView)
79 | }
80 |
81 | internal func arc(display: Bool, style: StyleProperty, baseWindow: UIWindow?) {
82 |
83 | prop = Property(style: style)
84 |
85 | guard let win = baseWindow, let prop = prop else {
86 | return
87 | }
88 |
89 | win.isUserInteractionEnabled = !(prop.backgroundStyle.rawValue == 0) ? true : false // 0 == .None
90 |
91 | getViewRect()
92 |
93 | getBlurView()
94 |
95 | progressAtRatioView = ProgressAtRatioView(frame: CGRect(x: 0, y: 0, width: prop.progressSize, height: prop.progressSize))
96 |
97 | guard let progressAtRatioView = progressAtRatioView else {
98 | return
99 | }
100 |
101 | progressAtRatioView.prop = prop
102 | progressAtRatioView.initialize(frame: progressAtRatioView.frame)
103 |
104 | if display {
105 | progressAtRatioView.showRatio()
106 | }
107 |
108 | progressAtRatioView.center = view.center
109 | view.addSubview(progressAtRatioView)
110 | }
111 |
112 | internal func circle(message: String?, style: StyleProperty, baseWindow: UIWindow?) {
113 |
114 | prop = Property(style: style)
115 |
116 | guard let win = baseWindow, let prop = prop else {
117 | return
118 | }
119 |
120 | win.isUserInteractionEnabled = !(prop.backgroundStyle.rawValue == 0) ? true : false // 0 == .None
121 |
122 | getViewRect()
123 |
124 | getBlurView()
125 |
126 | circularProgressView = CircularProgressView(frame: CGRect(x: 0, y: 0, width: prop.progressSize, height: prop.progressSize))
127 |
128 | guard let circularProgressView = circularProgressView else {
129 | return
130 | }
131 |
132 | circularProgressView.prop = prop
133 | circularProgressView.initialize(frame: circularProgressView.frame)
134 |
135 | if message != nil {
136 | circularProgressView.showMessage(message!)
137 | }
138 |
139 | circularProgressView.center = view.center
140 | view.addSubview(circularProgressView)
141 | }
142 |
143 | internal func updateMessage(message: String) {
144 |
145 | guard let circularProgressView = circularProgressView else {
146 | return
147 | }
148 |
149 | circularProgressView.message = message
150 | }
151 |
152 | internal func dismiss(_ t: Double) {
153 |
154 | let delay = t * Double(NSEC_PER_SEC)
155 | let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
156 |
157 | DispatchQueue.main.asyncAfter(deadline: time) {
158 | guard let blurView = self.blurView, let progressAtRatioView = self.progressAtRatioView, let circularProgressView = self.circularProgressView else {
159 | return
160 | }
161 |
162 | UIView.animate(
163 | withDuration: 0.3,
164 | animations: {
165 | progressAtRatioView.alpha = 0.0
166 | circularProgressView.alpha = 0.0
167 | },
168 | completion: { finished in
169 | progressAtRatioView.removeFromSuperview()
170 | circularProgressView.removeFromSuperview()
171 | blurView.removeFromSuperview()
172 | }
173 | )
174 | }
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/source/Progress/Elements/GradientArcWithClearColorView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GradientArcWithClearColorView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/20.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class GradientArcWithClearColorView: UIView {
12 |
13 | internal func draw(rect: CGRect, prop: Property) -> UIImageView {
14 | // Gradient Clear Circular
15 |
16 | /* Prop */
17 | var startArcColorProp = prop
18 | var endArcColorProp = prop
19 | var startGradientMaskProp = prop
20 | var endGradientMaskProp = prop
21 | var solidMaskProp = prop
22 |
23 | // StartArc
24 | startArcColorProp.endArcColor = ColorUtil.toNotOpacityColor(color: startArcColorProp.startArcColor)
25 |
26 | // EndArc
27 | endArcColorProp.startArcColor = ColorUtil.toNotOpacityColor(color: endArcColorProp.endArcColor)
28 |
29 | // StartGradientMask
30 | startGradientMaskProp.startArcColor = UIColor.black
31 | startGradientMaskProp.endArcColor = UIColor.white
32 | startGradientMaskProp.progressSize += 10.0
33 | startGradientMaskProp.arcLineWidth += 20.0
34 |
35 | // EndGradientMask
36 | endGradientMaskProp.startArcColor = UIColor.white
37 | endGradientMaskProp.endArcColor = UIColor.black
38 | endGradientMaskProp.progressSize += 10.0
39 | endGradientMaskProp.arcLineWidth += 20.0
40 |
41 | // SolidMask
42 | solidMaskProp.startArcColor = UIColor.black
43 | solidMaskProp.endArcColor = UIColor.black
44 |
45 | /* Mask Image */
46 | // StartArcColorImage
47 | let startArcColorView = ArcView(frame: rect, lineWidth: startArcColorProp.arcLineWidth)
48 | startArcColorView.color = startArcColorProp.startArcColor
49 | startArcColorView.prop = startArcColorProp
50 | let startArcColorImage = viewToUIImage(view: startArcColorView)!
51 |
52 | // StartGradientMaskImage
53 | let startGradientMaskView = GradientArcView(frame: rect)
54 | startGradientMaskView.prop = startGradientMaskProp
55 | let startGradientMaskImage = viewToUIImage(view: startGradientMaskView)!
56 |
57 | // EndArcColorImage
58 | let endArcColorView = ArcView(frame: rect, lineWidth: endArcColorProp.arcLineWidth)
59 | endArcColorView.color = endArcColorProp.startArcColor
60 | endArcColorView.prop = endArcColorProp
61 | let endArcColorImage = viewToUIImage(view: endArcColorView)!
62 |
63 | // EndGradientMaskImage
64 | let endGradientMaskView = GradientArcView(frame: rect)
65 | endGradientMaskView.prop = endGradientMaskProp
66 | let endGradientMaskImage = viewToUIImage(view: endGradientMaskView)!
67 |
68 | // SolidMaskImage
69 | let solidMaskView = ArcView(frame: rect, lineWidth: solidMaskProp.arcLineWidth)
70 | solidMaskView.prop = solidMaskProp
71 | let solidMaskImage = viewToUIImage(view: solidMaskView)!
72 |
73 | /* Masking */
74 | var startArcImage = mask(image: startGradientMaskImage, maskImage: solidMaskImage)
75 | startArcImage = mask(image: startArcColorImage, maskImage: startArcImage)
76 |
77 | var endArcImage = mask(image: endGradientMaskImage, maskImage: solidMaskImage)
78 | endArcImage = mask(image: endArcColorImage, maskImage: endArcImage)
79 |
80 | /* Composite */
81 | let image: UIImage = composite(image1: startArcImage, image2: endArcImage, prop: prop)
82 |
83 | /* UIImageView */
84 | let imageView = UIImageView(image: image)
85 | imageView.contentMode = .scaleAspectFill
86 | imageView.clipsToBounds = true
87 |
88 | return imageView
89 | }
90 |
91 | internal func mask(image: UIImage, maskImage: UIImage) -> UIImage {
92 |
93 | let maskRef: CGImage = maskImage.cgImage!
94 | let mask: CGImage = CGImage(
95 | maskWidth: maskRef.width,
96 | height: maskRef.height,
97 | bitsPerComponent: maskRef.bitsPerComponent,
98 | bitsPerPixel: maskRef.bitsPerPixel,
99 | bytesPerRow: maskRef.bytesPerRow,
100 | provider: maskRef.dataProvider!,
101 | decode: nil,
102 | shouldInterpolate: false)!
103 |
104 | let maskedImageRef: CGImage = image.cgImage!.masking(mask)!
105 | let scale = UIScreen.main.scale
106 | let maskedImage: UIImage = UIImage(cgImage: maskedImageRef, scale: scale, orientation: .up)
107 |
108 | return maskedImage
109 | }
110 |
111 | internal func viewToUIImage(view: UIView) -> UIImage? {
112 |
113 | let scale = UIScreen.main.scale
114 | UIGraphicsBeginImageContextWithOptions(view.frame.size, false, scale)
115 | view.layer.render(in: UIGraphicsGetCurrentContext()!)
116 | let image = UIGraphicsGetImageFromCurrentImageContext()
117 | UIGraphicsEndImageContext()
118 |
119 | return image
120 | }
121 |
122 | internal func composite(image1: UIImage, image2: UIImage, prop: Property) -> UIImage {
123 |
124 | let scale = UIScreen.main.scale
125 | UIGraphicsBeginImageContextWithOptions(image1.size, false, scale)
126 | image1.draw(
127 | in: CGRect(x: 0, y: 0, width: image1.size.width, height: image1.size.height),
128 | blendMode: .overlay,
129 | alpha: ColorUtil.toRGBA(color: prop.startArcColor).a)
130 | image2.draw(
131 | in: CGRect(x: 0, y: 0, width: image2.size.width, height: image2.size.height),
132 | blendMode: .overlay,
133 | alpha: ColorUtil.toRGBA(color: prop.endArcColor).a)
134 | let image = UIGraphicsGetImageFromCurrentImageContext()
135 | UIGraphicsEndImageContext()
136 |
137 | return image!
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/ProgressViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ProgressViewController.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/06/24.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ProgressViewController: UIViewController {
12 |
13 | private var viewRect: CGRect?
14 | private var blurView: UIVisualEffectView?
15 | private var progressAtRatioView: ProgressAtRatioView?
16 | private var circularProgressView: CircularProgressView?
17 | internal var prop: Property?
18 |
19 | internal var ratio: CGFloat = 0.0 {
20 | didSet {
21 | progressAtRatioView?.ratio = ratio
22 | progressAtRatioView?.setNeedsDisplay()
23 | }
24 | }
25 |
26 | override func viewDidLoad() {
27 | super.viewDidLoad()
28 |
29 | view.backgroundColor = UIColor.clear
30 | }
31 |
32 | override func didReceiveMemoryWarning() {
33 | super.didReceiveMemoryWarning()
34 | }
35 |
36 | override var shouldAutorotate: Bool {
37 | return false
38 | }
39 |
40 | override var prefersStatusBarHidden: Bool {
41 | let orientation: UIInterfaceOrientation
42 | if #available(iOS 13.0, *) {
43 | orientation = UIApplication.shared.windows.first?.windowScene?.interfaceOrientation ?? .portrait
44 | } else {
45 | orientation = UIApplication.shared.statusBarOrientation
46 | }
47 |
48 | switch orientation {
49 | case .landscapeLeft, .landscapeRight:
50 | // LandscapeLeft | LandscapeRight
51 | return true
52 | default:
53 | // Unknown | Portrait | PortraitUpsideDown
54 | return false
55 | }
56 | }
57 |
58 | private func getViewRect() {
59 |
60 | let window = UIWindow(frame: UIScreen.main.bounds)
61 |
62 | viewRect = window.frame
63 | }
64 |
65 | private func getBlurView() {
66 |
67 | guard let rect = viewRect, let prop = prop else {
68 | return
69 | }
70 |
71 | blurView = Background().blurEffectView(fromBlurStyle: prop.backgroundStyle, frame: rect)
72 |
73 | guard let blurView = blurView else {
74 | return
75 | }
76 |
77 | view.backgroundColor = UIColor.clear
78 | view.addSubview(blurView)
79 | }
80 |
81 | internal func arc(display: Bool, style: StyleProperty, baseWindow: UIWindow?) {
82 |
83 | prop = Property(style: style)
84 |
85 | guard let win = baseWindow, let prop = prop else {
86 | return
87 | }
88 |
89 | win.isUserInteractionEnabled = !(prop.backgroundStyle.rawValue == 0) ? true : false // 0 == .None
90 |
91 | getViewRect()
92 |
93 | getBlurView()
94 |
95 | progressAtRatioView = ProgressAtRatioView(frame: CGRect(x: 0, y: 0, width: prop.progressSize, height: prop.progressSize))
96 |
97 | guard let progressAtRatioView = progressAtRatioView else {
98 | return
99 | }
100 |
101 | progressAtRatioView.prop = prop
102 | progressAtRatioView.initialize(frame: progressAtRatioView.frame)
103 |
104 | if display {
105 | progressAtRatioView.showRatio()
106 | }
107 |
108 | progressAtRatioView.center = view.center
109 | view.addSubview(progressAtRatioView)
110 | }
111 |
112 | internal func circle(message: String?, style: StyleProperty, baseWindow: UIWindow?) {
113 |
114 | prop = Property(style: style)
115 |
116 | guard let win = baseWindow, let prop = prop else {
117 | return
118 | }
119 |
120 | win.isUserInteractionEnabled = !(prop.backgroundStyle.rawValue == 0) ? true : false // 0 == .None
121 |
122 | getViewRect()
123 |
124 | getBlurView()
125 |
126 | circularProgressView = CircularProgressView(frame: CGRect(x: 0, y: 0, width: prop.progressSize, height: prop.progressSize))
127 |
128 | guard let circularProgressView = circularProgressView else {
129 | return
130 | }
131 |
132 | circularProgressView.prop = prop
133 | circularProgressView.initialize(frame: circularProgressView.frame)
134 |
135 | if message != nil {
136 | circularProgressView.showMessage(message!)
137 | }
138 |
139 | circularProgressView.center = view.center
140 | view.addSubview(circularProgressView)
141 | }
142 |
143 | internal func updateMessage(message: String) {
144 |
145 | guard let circularProgressView = circularProgressView else {
146 | return
147 | }
148 |
149 | circularProgressView.message = message
150 | }
151 |
152 | internal func dismiss(_ t: Double) {
153 |
154 | let delay = t * Double(NSEC_PER_SEC)
155 | let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
156 |
157 | DispatchQueue.main.asyncAfter(deadline: time) {
158 | guard let blurView = self.blurView, let progressAtRatioView = self.progressAtRatioView, let circularProgressView = self.circularProgressView else {
159 | return
160 | }
161 |
162 | UIView.animate(
163 | withDuration: 0.3,
164 | animations: {
165 | progressAtRatioView.alpha = 0.0
166 | circularProgressView.alpha = 0.0
167 | },
168 | completion: { finished in
169 | progressAtRatioView.removeFromSuperview()
170 | circularProgressView.removeFromSuperview()
171 | blurView.removeFromSuperview()
172 | }
173 | )
174 | }
175 | }
176 | }
177 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/Progress/Elements/GradientArcWithClearColorView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GradientArcWithClearColorView.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/11/20.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class GradientArcWithClearColorView: UIView {
12 |
13 | internal func draw(rect: CGRect, prop: Property) -> UIImageView {
14 | // Gradient Clear Circular
15 |
16 | /* Prop */
17 | var startArcColorProp = prop
18 | var endArcColorProp = prop
19 | var startGradientMaskProp = prop
20 | var endGradientMaskProp = prop
21 | var solidMaskProp = prop
22 |
23 | // StartArc
24 | startArcColorProp.endArcColor = ColorUtil.toNotOpacityColor(color: startArcColorProp.startArcColor)
25 |
26 | // EndArc
27 | endArcColorProp.startArcColor = ColorUtil.toNotOpacityColor(color: endArcColorProp.endArcColor)
28 |
29 | // StartGradientMask
30 | startGradientMaskProp.startArcColor = UIColor.black
31 | startGradientMaskProp.endArcColor = UIColor.white
32 | startGradientMaskProp.progressSize += 10.0
33 | startGradientMaskProp.arcLineWidth += 20.0
34 |
35 | // EndGradientMask
36 | endGradientMaskProp.startArcColor = UIColor.white
37 | endGradientMaskProp.endArcColor = UIColor.black
38 | endGradientMaskProp.progressSize += 10.0
39 | endGradientMaskProp.arcLineWidth += 20.0
40 |
41 | // SolidMask
42 | solidMaskProp.startArcColor = UIColor.black
43 | solidMaskProp.endArcColor = UIColor.black
44 |
45 | /* Mask Image */
46 | // StartArcColorImage
47 | let startArcColorView = ArcView(frame: rect, lineWidth: startArcColorProp.arcLineWidth)
48 | startArcColorView.color = startArcColorProp.startArcColor
49 | startArcColorView.prop = startArcColorProp
50 | let startArcColorImage = viewToUIImage(view: startArcColorView)!
51 |
52 | // StartGradientMaskImage
53 | let startGradientMaskView = GradientArcView(frame: rect)
54 | startGradientMaskView.prop = startGradientMaskProp
55 | let startGradientMaskImage = viewToUIImage(view: startGradientMaskView)!
56 |
57 | // EndArcColorImage
58 | let endArcColorView = ArcView(frame: rect, lineWidth: endArcColorProp.arcLineWidth)
59 | endArcColorView.color = endArcColorProp.startArcColor
60 | endArcColorView.prop = endArcColorProp
61 | let endArcColorImage = viewToUIImage(view: endArcColorView)!
62 |
63 | // EndGradientMaskImage
64 | let endGradientMaskView = GradientArcView(frame: rect)
65 | endGradientMaskView.prop = endGradientMaskProp
66 | let endGradientMaskImage = viewToUIImage(view: endGradientMaskView)!
67 |
68 | // SolidMaskImage
69 | let solidMaskView = ArcView(frame: rect, lineWidth: solidMaskProp.arcLineWidth)
70 | solidMaskView.prop = solidMaskProp
71 | let solidMaskImage = viewToUIImage(view: solidMaskView)!
72 |
73 | /* Masking */
74 | var startArcImage = mask(image: startGradientMaskImage, maskImage: solidMaskImage)
75 | startArcImage = mask(image: startArcColorImage, maskImage: startArcImage)
76 |
77 | var endArcImage = mask(image: endGradientMaskImage, maskImage: solidMaskImage)
78 | endArcImage = mask(image: endArcColorImage, maskImage: endArcImage)
79 |
80 | /* Composite */
81 | let image: UIImage = composite(image1: startArcImage, image2: endArcImage, prop: prop)
82 |
83 | /* UIImageView */
84 | let imageView = UIImageView(image: image)
85 | imageView.contentMode = .scaleAspectFill
86 | imageView.clipsToBounds = true
87 |
88 | return imageView
89 | }
90 |
91 | internal func mask(image: UIImage, maskImage: UIImage) -> UIImage {
92 |
93 | let maskRef: CGImage = maskImage.cgImage!
94 | let mask: CGImage = CGImage(
95 | maskWidth: maskRef.width,
96 | height: maskRef.height,
97 | bitsPerComponent: maskRef.bitsPerComponent,
98 | bitsPerPixel: maskRef.bitsPerPixel,
99 | bytesPerRow: maskRef.bytesPerRow,
100 | provider: maskRef.dataProvider!,
101 | decode: nil,
102 | shouldInterpolate: false)!
103 |
104 | let maskedImageRef: CGImage = image.cgImage!.masking(mask)!
105 | let scale = UIScreen.main.scale
106 | let maskedImage: UIImage = UIImage(cgImage: maskedImageRef, scale: scale, orientation: .up)
107 |
108 | return maskedImage
109 | }
110 |
111 | internal func viewToUIImage(view: UIView) -> UIImage? {
112 |
113 | let scale = UIScreen.main.scale
114 | UIGraphicsBeginImageContextWithOptions(view.frame.size, false, scale)
115 | view.layer.render(in: UIGraphicsGetCurrentContext()!)
116 | let image = UIGraphicsGetImageFromCurrentImageContext()
117 | UIGraphicsEndImageContext()
118 |
119 | return image
120 | }
121 |
122 | internal func composite(image1: UIImage, image2: UIImage, prop: Property) -> UIImage {
123 |
124 | let scale = UIScreen.main.scale
125 | UIGraphicsBeginImageContextWithOptions(image1.size, false, scale)
126 | image1.draw(
127 | in: CGRect(x: 0, y: 0, width: image1.size.width, height: image1.size.height),
128 | blendMode: .overlay,
129 | alpha: ColorUtil.toRGBA(color: prop.startArcColor).a)
130 | image2.draw(
131 | in: CGRect(x: 0, y: 0, width: image2.size.width, height: image2.size.height),
132 | blendMode: .overlay,
133 | alpha: ColorUtil.toRGBA(color: prop.endArcColor).a)
134 | let image = UIGraphicsGetImageFromCurrentImageContext()
135 | UIGraphicsEndImageContext()
136 |
137 | return image!
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Gradient Circular Progress
2 |
3 | Customizable progress indicator library in Swift
4 |
5 | ## Requirements
6 | - Swift 5.1
7 | - iOS 8.0 or later
8 |
9 | ## Screen Shots
10 |
11 | - Preset style: [BlueDarkStyle.swift](https://github.com/keygx/GradientCircularProgress/blob/master/Source/BlueDarkStyle.swift)
12 |
13 |  
14 |
15 | - All preset styles
16 |
17 | 
18 | 
19 |
20 | - Example Use AddSubView
21 |
22 |  
23 |
24 | ## Installation
25 |
26 | ### Carthage
27 |
28 | ```Cartfile
29 | github "keygx/GradientCircularProgress"
30 | ```
31 |
32 | ### CocoaPods
33 |
34 | ```PodFile
35 | pod 'GradientCircularProgress', :git => 'https://github.com/keygx/GradientCircularProgress'
36 | ```
37 |
38 | ### Swift versions support
39 |
40 | - Swift 5.1, tag "swift5.1"
41 | - Swift 5, tag "swift5"
42 | - Swift 4.2, tag "swift4.2"
43 | - Swift 4.1, tag "swift4.1"
44 | - Swift 4.0, tag "swift4.0"
45 |
46 |
47 | ## Style Settings
48 |
49 | Please make your original styles
50 |
51 | 
52 |
53 | - Define custom style structs that implements the StyleProperty Protocol
54 |
55 | [MyStyle.swift](https://github.com/keygx/GradientCircularProgress/blob/master/Sample/MyStyle.swift)
56 |
57 | ```swift
58 | import GradientCircularProgress
59 |
60 | public struct MyStyle : StyleProperty {
61 | /*** style properties **********************************************************************************/
62 |
63 | // Progress Size
64 | public var progressSize: CGFloat = 200
65 |
66 | // Gradient Circular
67 | public var arcLineWidth: CGFloat = 18.0
68 | public var startArcColor: UIColor = UIColor.clear()
69 | public var endArcColor: UIColor = UIColor.orange()
70 |
71 | // Base Circular
72 | public var baseLineWidth: CGFloat? = 19.0
73 | public var baseArcColor: UIColor? = UIColor.darkGray()
74 |
75 | // Ratio
76 | public var ratioLabelFont: UIFont? = UIFont(name: "Verdana-Bold", size: 16.0)
77 | public var ratioLabelFontColor: UIColor? = UIColor.white()
78 |
79 | // Message
80 | public var messageLabelFont: UIFont? = UIFont.systemFont(ofSize: 16.0)
81 | public var messageLabelFontColor: UIColor? = UIColor.white()
82 |
83 | // Background
84 | public var backgroundStyle: BackgroundStyles = .dark
85 |
86 | // Dismiss
87 | public var dismissTimeInterval: Double? = 0.0 // 'nil' for default setting.
88 |
89 | /*** style properties **********************************************************************************/
90 |
91 | public init() {}
92 | }
93 |
94 | ```
95 |
96 | 
97 |
98 | ## Usage
99 | ```swift
100 | import GradientCircularProgress
101 | ```
102 | ### Basic
103 | #### UIWindow
104 | ```swift
105 | let progress = GradientCircularProgress()
106 |
107 | progress.show(message: "Loading...", MyStyle())
108 |
109 | progress.dismiss()
110 | ```
111 | #### addSubView
112 | ```swift
113 | let progress = GradientCircularProgress()
114 |
115 | let progressView = progress.show(frame: rect, message: "Loading...", style: MyStyle())
116 | view.addSubview(progressView!)
117 |
118 | progress.dismiss(progress: progressView!)
119 | ```
120 |
121 | ### at Rtio
122 | #### UIWindow
123 | ```swift
124 | let progress = GradientCircularProgress()
125 |
126 | let ratio: CGFloat = CGFloat(totalBytesWritten) / CGFloat(totalBytesExpectedToWrite)
127 | progress.showAtRatio(style: MyStyle())
128 |
129 | progress.updateRatio(ratio)
130 |
131 | progress.dismiss()
132 | ```
133 | #### addSubView
134 | ```swift
135 | let progress = GradientCircularProgress()
136 |
137 | let progressView = progress.showAtRatio(frame: rect, display: true, style: MyStyle())
138 | view.addSubview(progressView!)
139 |
140 | progress.updateRatio(ratio)
141 |
142 | progress.dismiss(progress: progressView!)
143 | ```
144 |
145 | ### Update Message
146 | #### UIWindow
147 | ```swift
148 | let progress = GradientCircularProgress()
149 |
150 | progress.show(message: "Download\n0 / 4", MyStyle())
151 |
152 | progress.updateMessage(message: "Download\n1 / 4")
153 | progress.updateMessage(message: "Download\n2 / 4")
154 | progress.updateMessage(message: "Download\n3 / 4")
155 | progress.updateMessage(message: "Download\n4 / 4")
156 | progress.updateMessage(message: "Completed!")
157 |
158 | progress.dismiss()
159 | ```
160 | #### addSubView
161 | ```swift
162 | let progress = GradientCircularProgress()
163 |
164 | let progressView = progress.show(frame: rect, message: "Download\n0 / 4", style: MyStyle())
165 | view.addSubview(progressView!)
166 |
167 | progress.updateMessage(message: "Download\n1 / 4")
168 | progress.updateMessage(message: "Download\n2 / 4")
169 | progress.updateMessage(message: "Download\n3 / 4")
170 | progress.updateMessage(message: "Download\n4 / 4")
171 | progress.updateMessage(message: "Completed!")
172 |
173 | progress.dismiss(progress: progressView!)
174 | ```
175 |
176 | ## API
177 | ### Use UIWindow
178 | ```swift
179 | public func showAtRatio(display: Bool = true, style: StyleProperty = Style())
180 |
181 | public func show(style: StyleProperty = Style())
182 |
183 | public func show(message: String, style: StyleProperty = Style())
184 |
185 | public func dismiss()
186 |
187 | public func dismiss(_ completionHandler: () -> Void) -> ()
188 | ```
189 |
190 | ### Use addSubView
191 | ```swift
192 | public func showAtRatio(frame: CGRect, display: Bool = true, style: StyleProperty = Style()) -> UIView?
193 |
194 | public func show(frame: CGRect, style: StyleProperty = Style()) -> UIView?
195 |
196 | public func show(frame: CGRect, message: String, style: StyleProperty = Style()) -> UIView?
197 |
198 | public func dismiss(progress view: UIView)
199 |
200 | public func dismiss(progress view: UIView, completionHandler: () -> Void) -> ()
201 | ```
202 |
203 | ### Common
204 | ```swift
205 | public func updateMessage(message message: String)
206 |
207 | public func updateRatio(_ ratio: CGFloat)
208 | ```
209 |
210 | ## License
211 |
212 | Gradient Circular Progress is released under the MIT license. See LICENSE for details.
213 |
214 | ## Author
215 |
216 | Yukihiko Kagiyama (keygx)
217 |
218 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/AlertHelperKit.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AlertHelperKit.swift
3 | //
4 | // Created by keygx on 2015/07/21.
5 | // Copyright (c) 2015年 keygx. All rights reserved.
6 | //
7 |
8 | import UIKit
9 |
10 | public enum ActionSheetPopoverStyle: Int {
11 | case normal = 0
12 | case barButton
13 | }
14 |
15 | public struct Parameters {
16 | var title: String?
17 | var message: String?
18 | var cancelButton: String?
19 | var destructiveButtons: [String]?
20 | var otherButtons: [String]?
21 | var disabledButtons: [String]?
22 | var inputFields: [InputField]?
23 | var sender: AnyObject?
24 | var arrowDirection: UIPopoverArrowDirection?
25 | var popoverStyle: ActionSheetPopoverStyle = .normal
26 |
27 | public init(
28 | title: String? = nil,
29 | message: String? = nil,
30 | cancelButton: String? = nil,
31 | destructiveButtons: [String]? = nil,
32 | otherButtons: [String]? = nil,
33 | disabledButtons: [String]? = nil,
34 | inputFields: [InputField]? = nil,
35 | sender: AnyObject? = nil,
36 | arrowDirection: UIPopoverArrowDirection? = nil,
37 | popoverStyle: ActionSheetPopoverStyle = .normal
38 | ) {
39 | self.title = title
40 | self.message = message
41 | self.cancelButton = cancelButton
42 | self.destructiveButtons = destructiveButtons
43 | self.otherButtons = otherButtons
44 | self.disabledButtons = disabledButtons
45 | self.inputFields = inputFields
46 | self.sender = sender
47 | self.arrowDirection = arrowDirection
48 | self.popoverStyle = popoverStyle
49 | }
50 | }
51 |
52 | public struct InputField {
53 | var placeholder: String
54 | var secure: Bool?
55 |
56 | public init(placeholder: String, secure: Bool?) {
57 | self.placeholder = placeholder
58 | self.secure = secure
59 | }
60 | }
61 |
62 | public class AlertHelperKit {
63 |
64 | public var animated: Bool = true
65 | public var completionHandler: (() -> Void)?
66 | public var textFields: [AnyObject]?
67 |
68 | public init() {
69 | initialize()
70 | }
71 |
72 | private func initialize() {
73 | animated = true
74 | completionHandler = nil
75 | textFields = nil
76 | }
77 |
78 | // Alert
79 | public func showAlert(_ parent: UIViewController, title: String?, message: String?, button: String) {
80 | let alertController = UIAlertController(title: title, message: message, preferredStyle: .alert)
81 |
82 | // cancel
83 | let cancelAction = UIAlertAction(title: button, style: .cancel, handler: nil)
84 | alertController.addAction(cancelAction)
85 |
86 | show(parent, ac: alertController)
87 | }
88 |
89 | // Alert with Callback Handler
90 | public func showAlertWithHandler(_ parent: UIViewController, parameters: Parameters, handler: @escaping (Int) -> ()) {
91 | let alertController: UIAlertController = buildAlertController(.alert, params: parameters) { buttonIndex in
92 | handler(buttonIndex)
93 | }
94 |
95 | buttonDisabled(alertController, params: parameters)
96 |
97 | show(parent, ac: alertController)
98 | }
99 |
100 | // ActionSheet
101 | public func showActionSheet(_ parent: UIViewController, parameters: Parameters, handler: @escaping (Int) -> ()) {
102 | let alertController: UIAlertController = buildAlertController(.actionSheet, params: parameters) { buttonIndex in
103 | handler(buttonIndex)
104 | }
105 |
106 | buttonDisabled(alertController, params: parameters)
107 |
108 | if let popover = alertController.popoverPresentationController, let sender: AnyObject = parameters.sender, let arrowDirection = parameters.arrowDirection {
109 | popover.sourceView = parent.view
110 |
111 | switch parameters.popoverStyle {
112 | case .barButton:
113 | guard let barButton = sender as? UIBarButtonItem else { return }
114 | popover.barButtonItem = barButton
115 | default:
116 | guard let button = sender as? UIButton else { return }
117 | popover.sourceRect = button.frame
118 | }
119 |
120 | popover.permittedArrowDirections = arrowDirection
121 | }
122 |
123 | show(parent, ac: alertController)
124 | }
125 |
126 | // Build AlertController
127 | private func buildAlertController(_ style: UIAlertController.Style, params: Parameters, handler: @escaping (Int) -> ()) -> UIAlertController {
128 |
129 | let alertController = UIAlertController(title: params.title, message: params.message, preferredStyle: style)
130 | let destructivOffset = 1
131 | var othersOffset = destructivOffset
132 |
133 | // cancel
134 | if let cancel = params.cancelButton {
135 | let cancelAction = UIAlertAction(title: cancel, style: .cancel) { _ in
136 | handler(0)
137 | }
138 | alertController.addAction(cancelAction)
139 | }
140 |
141 | // destructive
142 | if let destructive = params.destructiveButtons {
143 | for i in 0.. Void) -> () {
136 | if !isAvailable {
137 | return
138 | }
139 |
140 | guard let prop = property else {
141 | return
142 | }
143 |
144 | if let vc = progressViewController {
145 | vc.dismiss(prop.dismissTimeInterval!)
146 | }
147 |
148 | cleanup(prop.dismissTimeInterval!) {
149 | completionHandler()
150 | }
151 | }
152 |
153 | private func cleanup(_ t: Double, completionHandler: (() -> Void)?) {
154 | let delay = t * Double(NSEC_PER_SEC)
155 | let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
156 |
157 | DispatchQueue.main.asyncAfter(deadline: time) { [weak self] in
158 | guard let win = self?.baseWindow else {
159 | return
160 | }
161 |
162 | UIView.animate(
163 | withDuration: 0.3,
164 | animations: {
165 | win.alpha = 0
166 | },
167 | completion: { finished in
168 | self?.progressViewController = nil
169 | win.isHidden = true
170 | win.rootViewController = nil
171 | self?.baseWindow = nil
172 | self?.property = nil
173 | self?.isAvailable = false
174 | guard let completionHandler = completionHandler else {
175 | return
176 | }
177 | completionHandler()
178 | }
179 | )
180 | }
181 | }
182 | }
183 |
184 | // MARK: Use addSubView
185 | extension GradientCircularProgress {
186 |
187 | public func showAtRatio(frame: CGRect, display: Bool = true, style: StyleProperty = Style()) -> UIView? {
188 | if isAvailable {
189 | return nil
190 | }
191 | isAvailable = true
192 | property = Property(style: style)
193 |
194 | progressView = ProgressView(frame: frame)
195 |
196 | guard let v = progressView else {
197 | return nil
198 | }
199 |
200 | v.arc(display, style: style)
201 |
202 | return v
203 | }
204 |
205 | public func show(frame: CGRect, style: StyleProperty = Style()) -> UIView? {
206 | if isAvailable {
207 | return nil
208 | }
209 | isAvailable = true
210 | property = Property(style: style)
211 |
212 | return getProgress(frame: frame, message: nil, style: style)
213 | }
214 |
215 | public func show(frame: CGRect, message: String, style: StyleProperty = Style()) -> UIView? {
216 | if isAvailable {
217 | return nil
218 | }
219 | isAvailable = true
220 | property = Property(style: style)
221 |
222 | return getProgress(frame: frame, message: message, style: style)
223 | }
224 |
225 | private func getProgress(frame: CGRect, message: String?, style: StyleProperty) -> UIView? {
226 |
227 | progressView = ProgressView(frame: frame)
228 |
229 | guard let v = progressView else {
230 | return nil
231 | }
232 |
233 | v.circle(message, style: style)
234 |
235 | return v
236 | }
237 |
238 | public func dismiss(progress view: UIView) {
239 | if !isAvailable {
240 | return
241 | }
242 |
243 | guard let prop = property else {
244 | return
245 | }
246 |
247 | cleanup(prop.dismissTimeInterval!, view: view, completionHandler: nil)
248 | }
249 |
250 | public func dismiss(progress view: UIView, completionHandler: @escaping () -> Void) -> () {
251 | if !isAvailable {
252 | return
253 | }
254 |
255 | guard let prop = property else {
256 | return
257 | }
258 |
259 | cleanup(prop.dismissTimeInterval!, view: view) {
260 | completionHandler()
261 | }
262 | }
263 |
264 | private func cleanup(_ t: Double, view: UIView, completionHandler: (() -> Void)?) {
265 | let delay = t * Double(NSEC_PER_SEC)
266 | let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
267 |
268 | DispatchQueue.main.asyncAfter(deadline: time) {
269 | UIView.animate(
270 | withDuration: 0.3,
271 | animations: {
272 | view.alpha = 0
273 | },
274 | completion: { [weak self] finished in
275 | view.removeFromSuperview()
276 | self?.property = nil
277 | self?.isAvailable = false
278 | guard let completionHandler = completionHandler else {
279 | return
280 | }
281 | completionHandler()
282 | }
283 | )
284 | }
285 | }
286 | }
287 |
--------------------------------------------------------------------------------
/GCProgressSample/GradientCircularProgress/GradientCircularProgress.swift:
--------------------------------------------------------------------------------
1 | //
2 | // GradientCircularProgress.swift
3 | // GradientCircularProgress
4 | //
5 | // Created by keygx on 2015/07/29.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | public class GradientCircularProgress {
12 |
13 | private var baseWindow: UIWindow?
14 | private var progressViewController: ProgressViewController?
15 | private var progressView: ProgressView?
16 | private var property: Property?
17 |
18 | public var isAvailable: Bool = false
19 |
20 | public init() {}
21 | }
22 |
23 | // MARK: Common
24 | extension GradientCircularProgress {
25 |
26 | public func updateMessage(message: String) {
27 | if !isAvailable {
28 | return
29 | }
30 |
31 | // Use addSubView
32 | if let v = progressView {
33 | v.updateMessage(message)
34 | }
35 |
36 | // Use UIWindow
37 | if let vc = progressViewController {
38 | vc.updateMessage(message: message)
39 | }
40 | }
41 |
42 | public func updateRatio(_ ratio: CGFloat) {
43 | if !isAvailable {
44 | return
45 | }
46 |
47 | // Use addSubView
48 | if let v = progressView {
49 | v.ratio = ratio
50 | }
51 |
52 | // Use UIWindow
53 | if let vc = progressViewController {
54 | vc.ratio = ratio
55 | }
56 | }
57 | }
58 |
59 | // MARK: Use UIWindow
60 | extension GradientCircularProgress {
61 |
62 | public func showAtRatio(display: Bool = true, style: StyleProperty = Style()) {
63 | if isAvailable {
64 | return
65 | }
66 | isAvailable = true
67 | property = Property(style: style)
68 |
69 | getProgressAtRatio(display: display, style: style)
70 | }
71 |
72 | private func getProgressAtRatio(display: Bool, style: StyleProperty) {
73 | baseWindow = WindowBuilder.build()
74 | progressViewController = ProgressViewController()
75 |
76 | guard let win = baseWindow, let vc = progressViewController else {
77 | return
78 | }
79 |
80 | win.rootViewController = vc
81 | win.backgroundColor = UIColor.clear
82 | vc.arc(display: display, style: style, baseWindow: baseWindow)
83 | }
84 |
85 | public func show(style: StyleProperty = Style()) {
86 | if isAvailable {
87 | return
88 | }
89 | isAvailable = true
90 | property = Property(style: style)
91 |
92 | getProgress(message: nil, style: style)
93 | }
94 |
95 | public func show(message: String, style: StyleProperty = Style()) {
96 | if isAvailable {
97 | return
98 | }
99 | isAvailable = true
100 | property = Property(style: style)
101 |
102 | getProgress(message: message, style: style)
103 | }
104 |
105 | private func getProgress(message: String?, style: StyleProperty) {
106 | baseWindow = WindowBuilder.build()
107 | progressViewController = ProgressViewController()
108 |
109 | guard let win = baseWindow, let vc = progressViewController else {
110 | return
111 | }
112 |
113 | win.rootViewController = vc
114 | win.backgroundColor = UIColor.clear
115 | vc.circle(message: message, style: style, baseWindow: baseWindow)
116 | }
117 |
118 | public func dismiss() {
119 | if !isAvailable {
120 | return
121 | }
122 |
123 | guard let prop = property else {
124 | return
125 | }
126 |
127 | if let vc = progressViewController {
128 | vc.dismiss(prop.dismissTimeInterval!)
129 | }
130 |
131 | cleanup(prop.dismissTimeInterval!, completionHandler: nil)
132 |
133 | }
134 |
135 | public func dismiss(_ completionHandler: @escaping () -> Void) -> () {
136 | if !isAvailable {
137 | return
138 | }
139 |
140 | guard let prop = property else {
141 | return
142 | }
143 |
144 | if let vc = progressViewController {
145 | vc.dismiss(prop.dismissTimeInterval!)
146 | }
147 |
148 | cleanup(prop.dismissTimeInterval!) {
149 | completionHandler()
150 | }
151 | }
152 |
153 | private func cleanup(_ t: Double, completionHandler: (() -> Void)?) {
154 | let delay = t * Double(NSEC_PER_SEC)
155 | let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
156 |
157 | DispatchQueue.main.asyncAfter(deadline: time) { [weak self] in
158 | guard let win = self?.baseWindow else {
159 | return
160 | }
161 |
162 | UIView.animate(
163 | withDuration: 0.3,
164 | animations: {
165 | win.alpha = 0
166 | },
167 | completion: { finished in
168 | self?.progressViewController = nil
169 | win.isHidden = true
170 | win.rootViewController = nil
171 | self?.baseWindow = nil
172 | self?.property = nil
173 | self?.isAvailable = false
174 | guard let completionHandler = completionHandler else {
175 | return
176 | }
177 | completionHandler()
178 | }
179 | )
180 | }
181 | }
182 | }
183 |
184 | // MARK: Use addSubView
185 | extension GradientCircularProgress {
186 |
187 | public func showAtRatio(frame: CGRect, display: Bool = true, style: StyleProperty = Style()) -> UIView? {
188 | if isAvailable {
189 | return nil
190 | }
191 | isAvailable = true
192 | property = Property(style: style)
193 |
194 | progressView = ProgressView(frame: frame)
195 |
196 | guard let v = progressView else {
197 | return nil
198 | }
199 |
200 | v.arc(display, style: style)
201 |
202 | return v
203 | }
204 |
205 | public func show(frame: CGRect, style: StyleProperty = Style()) -> UIView? {
206 | if isAvailable {
207 | return nil
208 | }
209 | isAvailable = true
210 | property = Property(style: style)
211 |
212 | return getProgress(frame: frame, message: nil, style: style)
213 | }
214 |
215 | public func show(frame: CGRect, message: String, style: StyleProperty = Style()) -> UIView? {
216 | if isAvailable {
217 | return nil
218 | }
219 | isAvailable = true
220 | property = Property(style: style)
221 |
222 | return getProgress(frame: frame, message: message, style: style)
223 | }
224 |
225 | private func getProgress(frame: CGRect, message: String?, style: StyleProperty) -> UIView? {
226 |
227 | progressView = ProgressView(frame: frame)
228 |
229 | guard let v = progressView else {
230 | return nil
231 | }
232 |
233 | v.circle(message, style: style)
234 |
235 | return v
236 | }
237 |
238 | public func dismiss(progress view: UIView) {
239 | if !isAvailable {
240 | return
241 | }
242 |
243 | guard let prop = property else {
244 | return
245 | }
246 |
247 | cleanup(prop.dismissTimeInterval!, view: view, completionHandler: nil)
248 | }
249 |
250 | public func dismiss(progress view: UIView, completionHandler: @escaping () -> Void) -> () {
251 | if !isAvailable {
252 | return
253 | }
254 |
255 | guard let prop = property else {
256 | return
257 | }
258 |
259 | cleanup(prop.dismissTimeInterval!, view: view) {
260 | completionHandler()
261 | }
262 | }
263 |
264 | private func cleanup(_ t: Double, view: UIView, completionHandler: (() -> Void)?) {
265 | let delay = t * Double(NSEC_PER_SEC)
266 | let time = DispatchTime.now() + Double(Int64(delay)) / Double(NSEC_PER_SEC)
267 |
268 | DispatchQueue.main.asyncAfter(deadline: time) {
269 | UIView.animate(
270 | withDuration: 0.3,
271 | animations: {
272 | view.alpha = 0
273 | },
274 | completion: { [weak self] finished in
275 | view.removeFromSuperview()
276 | self?.property = nil
277 | self?.isAvailable = false
278 | guard let completionHandler = completionHandler else {
279 | return
280 | }
281 | completionHandler()
282 | }
283 | )
284 | }
285 | }
286 | }
287 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // GCProgressSample
4 | //
5 | // Created by keygx on 2016/03/12.
6 | // Copyright (c) 2015年 keygx. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import GradientCircularProgress
11 |
12 | class ViewController: UIViewController {
13 |
14 | // UI
15 | enum UsageType {
16 | case window
17 | case subView
18 | }
19 |
20 | let styleList: [(String, StyleProperty)] = [
21 | ("Style.swift", Style()),
22 | ("BlueDarkStyle.swift", BlueDarkStyle()),
23 | ("OrangeClearStyle.swift", OrangeClearStyle()),
24 | ("GreenLightStyle.swift", GreenLightStyle()),
25 | ("BlueIndicatorStyle.swift", BlueIndicatorStyle()),
26 | ("MyStyle.swift", MyStyle()),
27 | ("BackgroundTransparentStyle", BackgroundTransparentStyle()),
28 | ]
29 |
30 | var usageType: UsageType = .window
31 |
32 | var seletedStyleIndex: Int = 0 {
33 | willSet {
34 | styleLabel.text = styleList[newValue].0
35 | }
36 | }
37 |
38 | @IBOutlet weak var segmentedControl: UISegmentedControl!
39 | @IBOutlet weak var styleLabel: UILabel!
40 | @IBOutlet weak var btnAtRatio: MyButton!
41 | @IBOutlet weak var btnBasic: MyButton!
42 | @IBOutlet weak var btnUpdateMessage: MyButton!
43 |
44 | // Progress
45 | let progress = GradientCircularProgress()
46 | var progressView: UIView?
47 |
48 | // Demo
49 | var timer: Timer?
50 | var v: Double = 0.0
51 |
52 | override func viewDidLoad() {
53 | super.viewDidLoad()
54 |
55 | usageType = .window
56 | seletedStyleIndex = 0
57 | }
58 |
59 | override func didReceiveMemoryWarning() {
60 | super.didReceiveMemoryWarning()
61 | }
62 |
63 | @IBAction func segmentedControlAction(_ sender: AnyObject) {
64 | switch sender.selectedSegmentIndex {
65 | case 0:
66 | usageType = .window
67 | case 1:
68 | usageType = .subView
69 | default:
70 | break
71 | }
72 | }
73 |
74 | @IBAction func btnChooseStyleAction(_ sender: AnyObject) {
75 |
76 | let styleTitleList: [String] = styleList.map {$0.0}
77 |
78 | let params = Parameters(
79 | title: nil,
80 | message: nil,
81 | cancelButton: "Cancel",
82 | otherButtons: styleTitleList
83 | )
84 |
85 | AlertHelperKit().showAlertWithHandler(self, parameters: params) { buttonIndex in
86 | switch buttonIndex {
87 | case 1:
88 | self.seletedStyleIndex = buttonIndex - 1
89 | self.btnUpdateMessage.status = .normal
90 | case 2:
91 | self.seletedStyleIndex = buttonIndex - 1
92 | self.btnUpdateMessage.status = .normal
93 | case 3:
94 | self.seletedStyleIndex = buttonIndex - 1
95 | self.btnUpdateMessage.status = .disabled
96 | case 4:
97 | self.seletedStyleIndex = buttonIndex - 1
98 | self.btnUpdateMessage.status = .normal
99 | case 5:
100 | self.seletedStyleIndex = buttonIndex - 1
101 | self.btnUpdateMessage.status = .disabled
102 | case 6:
103 | self.seletedStyleIndex = buttonIndex - 1
104 | self.btnUpdateMessage.status = .normal
105 | case 7:
106 | self.seletedStyleIndex = buttonIndex - 1
107 | self.btnUpdateMessage.status = .normal
108 | default: break
109 | // Cancel
110 | }
111 | }
112 | }
113 |
114 | @IBAction func btnAtRatioAction(_ sender: AnyObject) {
115 | if progress.isAvailable {
116 | return
117 | }
118 |
119 | if usageType == .window {
120 | showAtRatio()
121 | } else {
122 | showAtRatioTypeSubView()
123 | }
124 | }
125 |
126 | @IBAction func btnBasicAction(_ sender: AnyObject) {
127 | if progress.isAvailable {
128 | return
129 | }
130 |
131 | if usageType == .window {
132 | showBasic()
133 | } else {
134 | showBasicTypeSubView()
135 | }
136 | }
137 |
138 | @IBAction func btnUpdateMessageAction(_ sender: AnyObject) {
139 | if progress.isAvailable {
140 | return
141 | }
142 |
143 | if usageType == .window {
144 | showUpdateMessage()
145 | } else {
146 | showUpdateMessageTypeSubView()
147 | }
148 | }
149 | }
150 |
151 | // UIWindow
152 | extension ViewController {
153 |
154 | func showAtRatio() {
155 | var displayFlag: Bool
156 |
157 | switch seletedStyleIndex {
158 | case 4:
159 | displayFlag = false
160 | default:
161 | displayFlag = true
162 | }
163 |
164 | progress.showAtRatio(display: displayFlag, style: styleList[seletedStyleIndex].1)
165 | startProgressAtRatio()
166 | }
167 |
168 | func showBasic() {
169 | progress.show(message: "Loading...", style: styleList[seletedStyleIndex].1)
170 | delayCloseProgress()
171 | }
172 |
173 | func showUpdateMessage() {
174 | progress.show(message: "Download\n0 / 4", style: styleList[seletedStyleIndex].1)
175 | startProgressBasic()
176 | }
177 | }
178 |
179 | // SubView
180 | extension ViewController {
181 |
182 | func showAtRatioTypeSubView() {
183 | var displayFlag: Bool
184 |
185 | switch seletedStyleIndex {
186 | case 4:
187 | displayFlag = false
188 | default:
189 | displayFlag = true
190 | }
191 |
192 | progressView = progress.showAtRatio(frame: getRect(), display: displayFlag, style: styleList[seletedStyleIndex].1)
193 | progressView?.layer.cornerRadius = 12.0
194 | view.addSubview(progressView!)
195 |
196 | startProgressAtRatio()
197 | }
198 |
199 | func showBasicTypeSubView() {
200 | progressView = progress.show(frame: getRect(), message: "Loading...", style: styleList[seletedStyleIndex].1)
201 | progressView?.layer.cornerRadius = 12.0
202 | view.addSubview(progressView!)
203 |
204 | delayCloseProgress()
205 | }
206 |
207 | func showUpdateMessageTypeSubView() {
208 | progressView = progress.show(frame: getRect(), message: "Download\n0 / 4", style: styleList[seletedStyleIndex].1)
209 | progressView?.layer.cornerRadius = 12.0
210 | view.addSubview(progressView!)
211 |
212 | startProgressBasic()
213 | }
214 | }
215 |
216 | // for demo
217 | extension ViewController {
218 |
219 | func delayCloseProgress() {
220 | AsyncUtil().dispatchOnMainThread({
221 | switch self.usageType {
222 | case .window:
223 | self.progress.dismiss()
224 | case .subView:
225 | self.progress.dismiss(progress: self.progressView!)
226 | }
227 | },
228 | delay: 2.0)
229 | }
230 |
231 | func startProgressBasic() {
232 | v = 0.0
233 |
234 | timer = Timer.scheduledTimer(
235 | timeInterval: 0.01,
236 | target: self,
237 | selector: #selector(updateMessage),
238 | userInfo: nil,
239 | repeats: true
240 | )
241 | RunLoop.main.add(timer!, forMode: RunLoop.Mode.common)
242 | }
243 |
244 | @objc func updateMessage() {
245 | v += 0.002
246 |
247 | if v > 1.00 {
248 | progress.updateMessage(message: "Download\n4 / 4")
249 | timer!.invalidate()
250 |
251 | AsyncUtil().dispatchOnMainThread({
252 | self.progress.updateMessage(message: "Completed!")
253 |
254 | switch self.usageType {
255 | case .window:
256 | self.progress.dismiss()
257 | case .subView:
258 | self.progress.dismiss(progress: self.progressView!)
259 | }
260 | }, delay: 0.8)
261 |
262 | return
263 |
264 | } else if v > 0.75 {
265 | progress.updateMessage(message: "Download\n3 / 4")
266 |
267 | } else if v > 0.5 {
268 | progress.updateMessage(message: "Download\n2 / 4")
269 |
270 | } else if v > 0.25 {
271 | progress.updateMessage(message: "Download\n1 / 4")
272 | }
273 | }
274 |
275 | func startProgressAtRatio() {
276 | v = 0.0
277 |
278 | timer = Timer.scheduledTimer(
279 | timeInterval: 0.01,
280 | target: self,
281 | selector: #selector(updateProgressAtRatio),
282 | userInfo: nil,
283 | repeats: true
284 | )
285 | RunLoop.main.add(timer!, forMode: RunLoop.Mode.common)
286 | }
287 |
288 | @objc func updateProgressAtRatio() {
289 | v += 0.01
290 |
291 | progress.updateRatio(CGFloat(v))
292 |
293 | if v > 1.00 {
294 | timer!.invalidate()
295 |
296 | switch usageType {
297 | case .window:
298 | progress.dismiss()
299 | case .subView:
300 | progress.dismiss(progress: progressView!)
301 | }
302 | return
303 | }
304 | }
305 |
306 | func getRect() -> CGRect {
307 | return CGRect(
308 | x: view.frame.origin.x + 15,
309 | y: (view.frame.size.height - view.frame.size.width) / 2,
310 | width: view.frame.size.width - 30,
311 | height: view.frame.size.width - 30)
312 | }
313 | }
314 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample/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 |
34 |
46 |
63 |
80 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
--------------------------------------------------------------------------------
/GCProgressSample/GCProgressSample.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 360F44AB1DF27B2800835EA0 /* BackgroundTransparentStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 360F44AA1DF27B2800835EA0 /* BackgroundTransparentStyle.swift */; };
11 | 362C51F91C9AB926008C1C81 /* AlertHelperKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 362C51F81C9AB926008C1C81 /* AlertHelperKit.swift */; };
12 | 3632ED251C7833CD006484E5 /* AsyncUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3632ED241C7833CD006484E5 /* AsyncUtil.swift */; };
13 | 366555DE1C9D900F00767B90 /* MyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 366555DD1C9D900F00767B90 /* MyButton.swift */; };
14 | 3667E0ED23392FEC002CCD9C /* WindowBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3667E0EC23392FEC002CCD9C /* WindowBuilder.swift */; };
15 | 368F0E4E1C35319E008B1AC4 /* MyStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 368F0E4D1C35319E008B1AC4 /* MyStyle.swift */; };
16 | 36CC1C821B37083E009DE1F8 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CC1C811B37083E009DE1F8 /* AppDelegate.swift */; };
17 | 36CC1C841B37083E009DE1F8 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CC1C831B37083E009DE1F8 /* ViewController.swift */; };
18 | 36CC1C871B37083E009DE1F8 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 36CC1C851B37083E009DE1F8 /* Main.storyboard */; };
19 | 36CC1C891B37083E009DE1F8 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 36CC1C881B37083E009DE1F8 /* Images.xcassets */; };
20 | 36CC1C8C1B37083E009DE1F8 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 36CC1C8A1B37083E009DE1F8 /* LaunchScreen.xib */; };
21 | 36CC1C981B37083E009DE1F8 /* GCProgressSampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CC1C971B37083E009DE1F8 /* GCProgressSampleTests.swift */; };
22 | 36CE2B5D1C93EA740084CE64 /* GradientCircularProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B471C93EA740084CE64 /* GradientCircularProgress.swift */; };
23 | 36CE2B5E1C93EA740084CE64 /* CircularProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B4A1C93EA740084CE64 /* CircularProgressView.swift */; };
24 | 36CE2B5F1C93EA740084CE64 /* ProgressAtRatioView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B4B1C93EA740084CE64 /* ProgressAtRatioView.swift */; };
25 | 36CE2B601C93EA740084CE64 /* ArcView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B4D1C93EA740084CE64 /* ArcView.swift */; };
26 | 36CE2B611C93EA740084CE64 /* Background.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B4E1C93EA740084CE64 /* Background.swift */; };
27 | 36CE2B631C93EA740084CE64 /* GradientArcView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B501C93EA740084CE64 /* GradientArcView.swift */; };
28 | 36CE2B641C93EA740084CE64 /* GradientArcWithClearColorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B511C93EA740084CE64 /* GradientArcWithClearColorView.swift */; };
29 | 36CE2B651C93EA740084CE64 /* ProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B521C93EA740084CE64 /* ProgressView.swift */; };
30 | 36CE2B661C93EA740084CE64 /* ProgressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B531C93EA740084CE64 /* ProgressViewController.swift */; };
31 | 36CE2B671C93EA740084CE64 /* Property.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B541C93EA740084CE64 /* Property.swift */; };
32 | 36CE2B681C93EA740084CE64 /* BlueDarkStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B561C93EA740084CE64 /* BlueDarkStyle.swift */; };
33 | 36CE2B691C93EA740084CE64 /* BlueIndicatorStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B571C93EA740084CE64 /* BlueIndicatorStyle.swift */; };
34 | 36CE2B6A1C93EA740084CE64 /* GreenLightStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B581C93EA740084CE64 /* GreenLightStyle.swift */; };
35 | 36CE2B6B1C93EA740084CE64 /* OrangeClearStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B591C93EA740084CE64 /* OrangeClearStyle.swift */; };
36 | 36CE2B6C1C93EA740084CE64 /* Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B5A1C93EA740084CE64 /* Style.swift */; };
37 | 36CE2B6D1C93EA740084CE64 /* ColorUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 36CE2B5C1C93EA740084CE64 /* ColorUtil.swift */; };
38 | 36F742C01B3A7016003D799C /* GradientCircularProgress.h in Headers */ = {isa = PBXBuildFile; fileRef = 36F742BF1B3A7016003D799C /* GradientCircularProgress.h */; settings = {ATTRIBUTES = (Public, ); }; };
39 | 36F742D21B3A7016003D799C /* GradientCircularProgress.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 36F742BB1B3A7016003D799C /* GradientCircularProgress.framework */; };
40 | 36F742D31B3A7016003D799C /* GradientCircularProgress.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 36F742BB1B3A7016003D799C /* GradientCircularProgress.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
41 | /* End PBXBuildFile section */
42 |
43 | /* Begin PBXContainerItemProxy section */
44 | 36CC1C921B37083E009DE1F8 /* PBXContainerItemProxy */ = {
45 | isa = PBXContainerItemProxy;
46 | containerPortal = 36CC1C741B37083E009DE1F8 /* Project object */;
47 | proxyType = 1;
48 | remoteGlobalIDString = 36CC1C7B1B37083E009DE1F8;
49 | remoteInfo = GCProgressSample;
50 | };
51 | 36F742D01B3A7016003D799C /* PBXContainerItemProxy */ = {
52 | isa = PBXContainerItemProxy;
53 | containerPortal = 36CC1C741B37083E009DE1F8 /* Project object */;
54 | proxyType = 1;
55 | remoteGlobalIDString = 36F742BA1B3A7016003D799C;
56 | remoteInfo = GradientCircularProgress;
57 | };
58 | /* End PBXContainerItemProxy section */
59 |
60 | /* Begin PBXCopyFilesBuildPhase section */
61 | 36F742D91B3A7016003D799C /* Embed Frameworks */ = {
62 | isa = PBXCopyFilesBuildPhase;
63 | buildActionMask = 2147483647;
64 | dstPath = "";
65 | dstSubfolderSpec = 10;
66 | files = (
67 | 36F742D31B3A7016003D799C /* GradientCircularProgress.framework in Embed Frameworks */,
68 | );
69 | name = "Embed Frameworks";
70 | runOnlyForDeploymentPostprocessing = 0;
71 | };
72 | /* End PBXCopyFilesBuildPhase section */
73 |
74 | /* Begin PBXFileReference section */
75 | 360F44AA1DF27B2800835EA0 /* BackgroundTransparentStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackgroundTransparentStyle.swift; sourceTree = ""; };
76 | 362C51F81C9AB926008C1C81 /* AlertHelperKit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AlertHelperKit.swift; sourceTree = ""; };
77 | 3632ED241C7833CD006484E5 /* AsyncUtil.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AsyncUtil.swift; sourceTree = ""; };
78 | 366555DD1C9D900F00767B90 /* MyButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyButton.swift; sourceTree = ""; };
79 | 3667E0EC23392FEC002CCD9C /* WindowBuilder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WindowBuilder.swift; sourceTree = ""; };
80 | 368F0E4D1C35319E008B1AC4 /* MyStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyStyle.swift; sourceTree = ""; };
81 | 36CC1C7C1B37083E009DE1F8 /* GCProgressSample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GCProgressSample.app; sourceTree = BUILT_PRODUCTS_DIR; };
82 | 36CC1C801B37083E009DE1F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
83 | 36CC1C811B37083E009DE1F8 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
84 | 36CC1C831B37083E009DE1F8 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
85 | 36CC1C861B37083E009DE1F8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
86 | 36CC1C881B37083E009DE1F8 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; };
87 | 36CC1C8B1B37083E009DE1F8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; };
88 | 36CC1C911B37083E009DE1F8 /* GCProgressSampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GCProgressSampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
89 | 36CC1C961B37083E009DE1F8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
90 | 36CC1C971B37083E009DE1F8 /* GCProgressSampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GCProgressSampleTests.swift; sourceTree = ""; };
91 | 36CE2B471C93EA740084CE64 /* GradientCircularProgress.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientCircularProgress.swift; sourceTree = ""; };
92 | 36CE2B4A1C93EA740084CE64 /* CircularProgressView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CircularProgressView.swift; sourceTree = ""; };
93 | 36CE2B4B1C93EA740084CE64 /* ProgressAtRatioView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressAtRatioView.swift; sourceTree = ""; };
94 | 36CE2B4D1C93EA740084CE64 /* ArcView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ArcView.swift; sourceTree = ""; };
95 | 36CE2B4E1C93EA740084CE64 /* Background.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Background.swift; sourceTree = ""; };
96 | 36CE2B501C93EA740084CE64 /* GradientArcView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientArcView.swift; sourceTree = ""; };
97 | 36CE2B511C93EA740084CE64 /* GradientArcWithClearColorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GradientArcWithClearColorView.swift; sourceTree = ""; };
98 | 36CE2B521C93EA740084CE64 /* ProgressView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressView.swift; sourceTree = ""; };
99 | 36CE2B531C93EA740084CE64 /* ProgressViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProgressViewController.swift; sourceTree = ""; };
100 | 36CE2B541C93EA740084CE64 /* Property.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Property.swift; sourceTree = ""; };
101 | 36CE2B561C93EA740084CE64 /* BlueDarkStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlueDarkStyle.swift; sourceTree = ""; };
102 | 36CE2B571C93EA740084CE64 /* BlueIndicatorStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlueIndicatorStyle.swift; sourceTree = ""; };
103 | 36CE2B581C93EA740084CE64 /* GreenLightStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GreenLightStyle.swift; sourceTree = ""; };
104 | 36CE2B591C93EA740084CE64 /* OrangeClearStyle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrangeClearStyle.swift; sourceTree = ""; };
105 | 36CE2B5A1C93EA740084CE64 /* Style.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Style.swift; sourceTree = ""; };
106 | 36CE2B5C1C93EA740084CE64 /* ColorUtil.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorUtil.swift; sourceTree = ""; };
107 | 36F742BB1B3A7016003D799C /* GradientCircularProgress.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GradientCircularProgress.framework; sourceTree = BUILT_PRODUCTS_DIR; };
108 | 36F742BE1B3A7016003D799C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
109 | 36F742BF1B3A7016003D799C /* GradientCircularProgress.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GradientCircularProgress.h; sourceTree = ""; };
110 | /* End PBXFileReference section */
111 |
112 | /* Begin PBXFrameworksBuildPhase section */
113 | 36CC1C791B37083E009DE1F8 /* Frameworks */ = {
114 | isa = PBXFrameworksBuildPhase;
115 | buildActionMask = 2147483647;
116 | files = (
117 | 36F742D21B3A7016003D799C /* GradientCircularProgress.framework in Frameworks */,
118 | );
119 | runOnlyForDeploymentPostprocessing = 0;
120 | };
121 | 36CC1C8E1B37083E009DE1F8 /* Frameworks */ = {
122 | isa = PBXFrameworksBuildPhase;
123 | buildActionMask = 2147483647;
124 | files = (
125 | );
126 | runOnlyForDeploymentPostprocessing = 0;
127 | };
128 | 36F742B71B3A7016003D799C /* Frameworks */ = {
129 | isa = PBXFrameworksBuildPhase;
130 | buildActionMask = 2147483647;
131 | files = (
132 | );
133 | runOnlyForDeploymentPostprocessing = 0;
134 | };
135 | /* End PBXFrameworksBuildPhase section */
136 |
137 | /* Begin PBXGroup section */
138 | 366555DA1C9D8BB600767B90 /* libs */ = {
139 | isa = PBXGroup;
140 | children = (
141 | 362C51F81C9AB926008C1C81 /* AlertHelperKit.swift */,
142 | 3632ED241C7833CD006484E5 /* AsyncUtil.swift */,
143 | 366555DD1C9D900F00767B90 /* MyButton.swift */,
144 | );
145 | name = libs;
146 | sourceTree = "";
147 | };
148 | 36CC1C731B37083E009DE1F8 = {
149 | isa = PBXGroup;
150 | children = (
151 | 36CC1C7E1B37083E009DE1F8 /* GCProgressSample */,
152 | 36CC1C941B37083E009DE1F8 /* GCProgressSampleTests */,
153 | 36F742BC1B3A7016003D799C /* GradientCircularProgress */,
154 | 36CC1C7D1B37083E009DE1F8 /* Products */,
155 | );
156 | sourceTree = "";
157 | };
158 | 36CC1C7D1B37083E009DE1F8 /* Products */ = {
159 | isa = PBXGroup;
160 | children = (
161 | 36CC1C7C1B37083E009DE1F8 /* GCProgressSample.app */,
162 | 36CC1C911B37083E009DE1F8 /* GCProgressSampleTests.xctest */,
163 | 36F742BB1B3A7016003D799C /* GradientCircularProgress.framework */,
164 | );
165 | name = Products;
166 | sourceTree = "";
167 | };
168 | 36CC1C7E1B37083E009DE1F8 /* GCProgressSample */ = {
169 | isa = PBXGroup;
170 | children = (
171 | 366555DA1C9D8BB600767B90 /* libs */,
172 | 36CC1C811B37083E009DE1F8 /* AppDelegate.swift */,
173 | 36CC1C831B37083E009DE1F8 /* ViewController.swift */,
174 | 368F0E4D1C35319E008B1AC4 /* MyStyle.swift */,
175 | 360F44AA1DF27B2800835EA0 /* BackgroundTransparentStyle.swift */,
176 | 36CC1C851B37083E009DE1F8 /* Main.storyboard */,
177 | 36CC1C881B37083E009DE1F8 /* Images.xcassets */,
178 | 36CC1C8A1B37083E009DE1F8 /* LaunchScreen.xib */,
179 | 36CC1C7F1B37083E009DE1F8 /* Supporting Files */,
180 | );
181 | path = GCProgressSample;
182 | sourceTree = "";
183 | };
184 | 36CC1C7F1B37083E009DE1F8 /* Supporting Files */ = {
185 | isa = PBXGroup;
186 | children = (
187 | 36CC1C801B37083E009DE1F8 /* Info.plist */,
188 | );
189 | name = "Supporting Files";
190 | sourceTree = "";
191 | };
192 | 36CC1C941B37083E009DE1F8 /* GCProgressSampleTests */ = {
193 | isa = PBXGroup;
194 | children = (
195 | 36CC1C971B37083E009DE1F8 /* GCProgressSampleTests.swift */,
196 | 36CC1C951B37083E009DE1F8 /* Supporting Files */,
197 | );
198 | path = GCProgressSampleTests;
199 | sourceTree = "";
200 | };
201 | 36CC1C951B37083E009DE1F8 /* Supporting Files */ = {
202 | isa = PBXGroup;
203 | children = (
204 | 36CC1C961B37083E009DE1F8 /* Info.plist */,
205 | );
206 | name = "Supporting Files";
207 | sourceTree = "";
208 | };
209 | 36CE2B481C93EA740084CE64 /* Progress */ = {
210 | isa = PBXGroup;
211 | children = (
212 | 36CE2B491C93EA740084CE64 /* Core */,
213 | 36CE2B4C1C93EA740084CE64 /* Elements */,
214 | 36CE2B521C93EA740084CE64 /* ProgressView.swift */,
215 | 36CE2B531C93EA740084CE64 /* ProgressViewController.swift */,
216 | 36CE2B541C93EA740084CE64 /* Property.swift */,
217 | );
218 | path = Progress;
219 | sourceTree = "";
220 | };
221 | 36CE2B491C93EA740084CE64 /* Core */ = {
222 | isa = PBXGroup;
223 | children = (
224 | 36CE2B4A1C93EA740084CE64 /* CircularProgressView.swift */,
225 | 36CE2B4B1C93EA740084CE64 /* ProgressAtRatioView.swift */,
226 | );
227 | path = Core;
228 | sourceTree = "";
229 | };
230 | 36CE2B4C1C93EA740084CE64 /* Elements */ = {
231 | isa = PBXGroup;
232 | children = (
233 | 36CE2B4D1C93EA740084CE64 /* ArcView.swift */,
234 | 36CE2B4E1C93EA740084CE64 /* Background.swift */,
235 | 3667E0EC23392FEC002CCD9C /* WindowBuilder.swift */,
236 | 36CE2B501C93EA740084CE64 /* GradientArcView.swift */,
237 | 36CE2B511C93EA740084CE64 /* GradientArcWithClearColorView.swift */,
238 | );
239 | path = Elements;
240 | sourceTree = "";
241 | };
242 | 36CE2B551C93EA740084CE64 /* Styles */ = {
243 | isa = PBXGroup;
244 | children = (
245 | 36CE2B561C93EA740084CE64 /* BlueDarkStyle.swift */,
246 | 36CE2B571C93EA740084CE64 /* BlueIndicatorStyle.swift */,
247 | 36CE2B581C93EA740084CE64 /* GreenLightStyle.swift */,
248 | 36CE2B591C93EA740084CE64 /* OrangeClearStyle.swift */,
249 | 36CE2B5A1C93EA740084CE64 /* Style.swift */,
250 | );
251 | path = Styles;
252 | sourceTree = "";
253 | };
254 | 36CE2B5B1C93EA740084CE64 /* Utils */ = {
255 | isa = PBXGroup;
256 | children = (
257 | 36CE2B5C1C93EA740084CE64 /* ColorUtil.swift */,
258 | );
259 | path = Utils;
260 | sourceTree = "";
261 | };
262 | 36F742BC1B3A7016003D799C /* GradientCircularProgress */ = {
263 | isa = PBXGroup;
264 | children = (
265 | 36CE2B471C93EA740084CE64 /* GradientCircularProgress.swift */,
266 | 36CE2B481C93EA740084CE64 /* Progress */,
267 | 36CE2B551C93EA740084CE64 /* Styles */,
268 | 36CE2B5B1C93EA740084CE64 /* Utils */,
269 | 36F742BF1B3A7016003D799C /* GradientCircularProgress.h */,
270 | 36F742BD1B3A7016003D799C /* Supporting Files */,
271 | );
272 | path = GradientCircularProgress;
273 | sourceTree = "";
274 | };
275 | 36F742BD1B3A7016003D799C /* Supporting Files */ = {
276 | isa = PBXGroup;
277 | children = (
278 | 36F742BE1B3A7016003D799C /* Info.plist */,
279 | );
280 | name = "Supporting Files";
281 | sourceTree = "";
282 | };
283 | /* End PBXGroup section */
284 |
285 | /* Begin PBXHeadersBuildPhase section */
286 | 36F742B81B3A7016003D799C /* Headers */ = {
287 | isa = PBXHeadersBuildPhase;
288 | buildActionMask = 2147483647;
289 | files = (
290 | 36F742C01B3A7016003D799C /* GradientCircularProgress.h in Headers */,
291 | );
292 | runOnlyForDeploymentPostprocessing = 0;
293 | };
294 | /* End PBXHeadersBuildPhase section */
295 |
296 | /* Begin PBXNativeTarget section */
297 | 36CC1C7B1B37083E009DE1F8 /* GCProgressSample */ = {
298 | isa = PBXNativeTarget;
299 | buildConfigurationList = 36CC1C9B1B37083E009DE1F8 /* Build configuration list for PBXNativeTarget "GCProgressSample" */;
300 | buildPhases = (
301 | 36CC1C781B37083E009DE1F8 /* Sources */,
302 | 36CC1C791B37083E009DE1F8 /* Frameworks */,
303 | 36CC1C7A1B37083E009DE1F8 /* Resources */,
304 | 36F742D91B3A7016003D799C /* Embed Frameworks */,
305 | );
306 | buildRules = (
307 | );
308 | dependencies = (
309 | 36F742D11B3A7016003D799C /* PBXTargetDependency */,
310 | );
311 | name = GCProgressSample;
312 | productName = GCProgressSample;
313 | productReference = 36CC1C7C1B37083E009DE1F8 /* GCProgressSample.app */;
314 | productType = "com.apple.product-type.application";
315 | };
316 | 36CC1C901B37083E009DE1F8 /* GCProgressSampleTests */ = {
317 | isa = PBXNativeTarget;
318 | buildConfigurationList = 36CC1C9E1B37083E009DE1F8 /* Build configuration list for PBXNativeTarget "GCProgressSampleTests" */;
319 | buildPhases = (
320 | 36CC1C8D1B37083E009DE1F8 /* Sources */,
321 | 36CC1C8E1B37083E009DE1F8 /* Frameworks */,
322 | 36CC1C8F1B37083E009DE1F8 /* Resources */,
323 | );
324 | buildRules = (
325 | );
326 | dependencies = (
327 | 36CC1C931B37083E009DE1F8 /* PBXTargetDependency */,
328 | );
329 | name = GCProgressSampleTests;
330 | productName = GCProgressSampleTests;
331 | productReference = 36CC1C911B37083E009DE1F8 /* GCProgressSampleTests.xctest */;
332 | productType = "com.apple.product-type.bundle.unit-test";
333 | };
334 | 36F742BA1B3A7016003D799C /* GradientCircularProgress */ = {
335 | isa = PBXNativeTarget;
336 | buildConfigurationList = 36F742D81B3A7016003D799C /* Build configuration list for PBXNativeTarget "GradientCircularProgress" */;
337 | buildPhases = (
338 | 36F742B61B3A7016003D799C /* Sources */,
339 | 36F742B71B3A7016003D799C /* Frameworks */,
340 | 36F742B81B3A7016003D799C /* Headers */,
341 | 36F742B91B3A7016003D799C /* Resources */,
342 | );
343 | buildRules = (
344 | );
345 | dependencies = (
346 | );
347 | name = GradientCircularProgress;
348 | productName = GradientCircularProgress;
349 | productReference = 36F742BB1B3A7016003D799C /* GradientCircularProgress.framework */;
350 | productType = "com.apple.product-type.framework";
351 | };
352 | /* End PBXNativeTarget section */
353 |
354 | /* Begin PBXProject section */
355 | 36CC1C741B37083E009DE1F8 /* Project object */ = {
356 | isa = PBXProject;
357 | attributes = {
358 | LastSwiftMigration = 0700;
359 | LastSwiftUpdateCheck = 0720;
360 | LastUpgradeCheck = 1100;
361 | ORGANIZATIONNAME = keygx;
362 | TargetAttributes = {
363 | 36CC1C7B1B37083E009DE1F8 = {
364 | CreatedOnToolsVersion = 6.3.2;
365 | DevelopmentTeam = 3CCNMX7TC9;
366 | DevelopmentTeamName = "Yukihiko Kagiyama";
367 | LastSwiftMigration = 1020;
368 | ProvisioningStyle = Automatic;
369 | };
370 | 36CC1C901B37083E009DE1F8 = {
371 | CreatedOnToolsVersion = 6.3.2;
372 | LastSwiftMigration = 0800;
373 | TestTargetID = 36CC1C7B1B37083E009DE1F8;
374 | };
375 | 36F742BA1B3A7016003D799C = {
376 | CreatedOnToolsVersion = 6.3.2;
377 | DevelopmentTeamName = "Yukihiko Kagiyama";
378 | LastSwiftMigration = 1020;
379 | };
380 | };
381 | };
382 | buildConfigurationList = 36CC1C771B37083E009DE1F8 /* Build configuration list for PBXProject "GCProgressSample" */;
383 | compatibilityVersion = "Xcode 3.2";
384 | developmentRegion = en;
385 | hasScannedForEncodings = 0;
386 | knownRegions = (
387 | en,
388 | Base,
389 | );
390 | mainGroup = 36CC1C731B37083E009DE1F8;
391 | productRefGroup = 36CC1C7D1B37083E009DE1F8 /* Products */;
392 | projectDirPath = "";
393 | projectRoot = "";
394 | targets = (
395 | 36CC1C7B1B37083E009DE1F8 /* GCProgressSample */,
396 | 36CC1C901B37083E009DE1F8 /* GCProgressSampleTests */,
397 | 36F742BA1B3A7016003D799C /* GradientCircularProgress */,
398 | );
399 | };
400 | /* End PBXProject section */
401 |
402 | /* Begin PBXResourcesBuildPhase section */
403 | 36CC1C7A1B37083E009DE1F8 /* Resources */ = {
404 | isa = PBXResourcesBuildPhase;
405 | buildActionMask = 2147483647;
406 | files = (
407 | 36CC1C871B37083E009DE1F8 /* Main.storyboard in Resources */,
408 | 36CC1C8C1B37083E009DE1F8 /* LaunchScreen.xib in Resources */,
409 | 36CC1C891B37083E009DE1F8 /* Images.xcassets in Resources */,
410 | );
411 | runOnlyForDeploymentPostprocessing = 0;
412 | };
413 | 36CC1C8F1B37083E009DE1F8 /* Resources */ = {
414 | isa = PBXResourcesBuildPhase;
415 | buildActionMask = 2147483647;
416 | files = (
417 | );
418 | runOnlyForDeploymentPostprocessing = 0;
419 | };
420 | 36F742B91B3A7016003D799C /* Resources */ = {
421 | isa = PBXResourcesBuildPhase;
422 | buildActionMask = 2147483647;
423 | files = (
424 | );
425 | runOnlyForDeploymentPostprocessing = 0;
426 | };
427 | /* End PBXResourcesBuildPhase section */
428 |
429 | /* Begin PBXSourcesBuildPhase section */
430 | 36CC1C781B37083E009DE1F8 /* Sources */ = {
431 | isa = PBXSourcesBuildPhase;
432 | buildActionMask = 2147483647;
433 | files = (
434 | 36CC1C841B37083E009DE1F8 /* ViewController.swift in Sources */,
435 | 362C51F91C9AB926008C1C81 /* AlertHelperKit.swift in Sources */,
436 | 360F44AB1DF27B2800835EA0 /* BackgroundTransparentStyle.swift in Sources */,
437 | 36CC1C821B37083E009DE1F8 /* AppDelegate.swift in Sources */,
438 | 3632ED251C7833CD006484E5 /* AsyncUtil.swift in Sources */,
439 | 368F0E4E1C35319E008B1AC4 /* MyStyle.swift in Sources */,
440 | 366555DE1C9D900F00767B90 /* MyButton.swift in Sources */,
441 | );
442 | runOnlyForDeploymentPostprocessing = 0;
443 | };
444 | 36CC1C8D1B37083E009DE1F8 /* Sources */ = {
445 | isa = PBXSourcesBuildPhase;
446 | buildActionMask = 2147483647;
447 | files = (
448 | 36CC1C981B37083E009DE1F8 /* GCProgressSampleTests.swift in Sources */,
449 | );
450 | runOnlyForDeploymentPostprocessing = 0;
451 | };
452 | 36F742B61B3A7016003D799C /* Sources */ = {
453 | isa = PBXSourcesBuildPhase;
454 | buildActionMask = 2147483647;
455 | files = (
456 | 36CE2B5F1C93EA740084CE64 /* ProgressAtRatioView.swift in Sources */,
457 | 3667E0ED23392FEC002CCD9C /* WindowBuilder.swift in Sources */,
458 | 36CE2B681C93EA740084CE64 /* BlueDarkStyle.swift in Sources */,
459 | 36CE2B601C93EA740084CE64 /* ArcView.swift in Sources */,
460 | 36CE2B671C93EA740084CE64 /* Property.swift in Sources */,
461 | 36CE2B5E1C93EA740084CE64 /* CircularProgressView.swift in Sources */,
462 | 36CE2B5D1C93EA740084CE64 /* GradientCircularProgress.swift in Sources */,
463 | 36CE2B631C93EA740084CE64 /* GradientArcView.swift in Sources */,
464 | 36CE2B6C1C93EA740084CE64 /* Style.swift in Sources */,
465 | 36CE2B661C93EA740084CE64 /* ProgressViewController.swift in Sources */,
466 | 36CE2B611C93EA740084CE64 /* Background.swift in Sources */,
467 | 36CE2B641C93EA740084CE64 /* GradientArcWithClearColorView.swift in Sources */,
468 | 36CE2B6B1C93EA740084CE64 /* OrangeClearStyle.swift in Sources */,
469 | 36CE2B651C93EA740084CE64 /* ProgressView.swift in Sources */,
470 | 36CE2B6A1C93EA740084CE64 /* GreenLightStyle.swift in Sources */,
471 | 36CE2B691C93EA740084CE64 /* BlueIndicatorStyle.swift in Sources */,
472 | 36CE2B6D1C93EA740084CE64 /* ColorUtil.swift in Sources */,
473 | );
474 | runOnlyForDeploymentPostprocessing = 0;
475 | };
476 | /* End PBXSourcesBuildPhase section */
477 |
478 | /* Begin PBXTargetDependency section */
479 | 36CC1C931B37083E009DE1F8 /* PBXTargetDependency */ = {
480 | isa = PBXTargetDependency;
481 | target = 36CC1C7B1B37083E009DE1F8 /* GCProgressSample */;
482 | targetProxy = 36CC1C921B37083E009DE1F8 /* PBXContainerItemProxy */;
483 | };
484 | 36F742D11B3A7016003D799C /* PBXTargetDependency */ = {
485 | isa = PBXTargetDependency;
486 | target = 36F742BA1B3A7016003D799C /* GradientCircularProgress */;
487 | targetProxy = 36F742D01B3A7016003D799C /* PBXContainerItemProxy */;
488 | };
489 | /* End PBXTargetDependency section */
490 |
491 | /* Begin PBXVariantGroup section */
492 | 36CC1C851B37083E009DE1F8 /* Main.storyboard */ = {
493 | isa = PBXVariantGroup;
494 | children = (
495 | 36CC1C861B37083E009DE1F8 /* Base */,
496 | );
497 | name = Main.storyboard;
498 | sourceTree = "";
499 | };
500 | 36CC1C8A1B37083E009DE1F8 /* LaunchScreen.xib */ = {
501 | isa = PBXVariantGroup;
502 | children = (
503 | 36CC1C8B1B37083E009DE1F8 /* Base */,
504 | );
505 | name = LaunchScreen.xib;
506 | sourceTree = "";
507 | };
508 | /* End PBXVariantGroup section */
509 |
510 | /* Begin XCBuildConfiguration section */
511 | 36CC1C991B37083E009DE1F8 /* Debug */ = {
512 | isa = XCBuildConfiguration;
513 | buildSettings = {
514 | ALWAYS_SEARCH_USER_PATHS = NO;
515 | BITCODE_GENERATION_MODE = marker;
516 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
517 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
518 | CLANG_CXX_LIBRARY = "libc++";
519 | CLANG_ENABLE_MODULES = YES;
520 | CLANG_ENABLE_OBJC_ARC = YES;
521 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
522 | CLANG_WARN_BOOL_CONVERSION = YES;
523 | CLANG_WARN_COMMA = YES;
524 | CLANG_WARN_CONSTANT_CONVERSION = YES;
525 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
526 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
527 | CLANG_WARN_EMPTY_BODY = YES;
528 | CLANG_WARN_ENUM_CONVERSION = YES;
529 | CLANG_WARN_INFINITE_RECURSION = YES;
530 | CLANG_WARN_INT_CONVERSION = YES;
531 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
532 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
533 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
534 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
535 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
536 | CLANG_WARN_STRICT_PROTOTYPES = YES;
537 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
538 | CLANG_WARN_UNREACHABLE_CODE = YES;
539 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
540 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
541 | COPY_PHASE_STRIP = NO;
542 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
543 | ENABLE_STRICT_OBJC_MSGSEND = YES;
544 | ENABLE_TESTABILITY = YES;
545 | GCC_C_LANGUAGE_STANDARD = gnu99;
546 | GCC_DYNAMIC_NO_PIC = NO;
547 | GCC_NO_COMMON_BLOCKS = YES;
548 | GCC_OPTIMIZATION_LEVEL = 0;
549 | GCC_PREPROCESSOR_DEFINITIONS = (
550 | "DEBUG=1",
551 | "$(inherited)",
552 | );
553 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
554 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
555 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
556 | GCC_WARN_UNDECLARED_SELECTOR = YES;
557 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
558 | GCC_WARN_UNUSED_FUNCTION = YES;
559 | GCC_WARN_UNUSED_VARIABLE = YES;
560 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
561 | MTL_ENABLE_DEBUG_INFO = YES;
562 | ONLY_ACTIVE_ARCH = YES;
563 | SDKROOT = iphoneos;
564 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
565 | SWIFT_VERSION = "";
566 | TARGETED_DEVICE_FAMILY = "1,2";
567 | };
568 | name = Debug;
569 | };
570 | 36CC1C9A1B37083E009DE1F8 /* Release */ = {
571 | isa = XCBuildConfiguration;
572 | buildSettings = {
573 | ALWAYS_SEARCH_USER_PATHS = NO;
574 | BITCODE_GENERATION_MODE = bitcode;
575 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
576 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
577 | CLANG_CXX_LIBRARY = "libc++";
578 | CLANG_ENABLE_MODULES = YES;
579 | CLANG_ENABLE_OBJC_ARC = YES;
580 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
581 | CLANG_WARN_BOOL_CONVERSION = YES;
582 | CLANG_WARN_COMMA = YES;
583 | CLANG_WARN_CONSTANT_CONVERSION = YES;
584 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
585 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
586 | CLANG_WARN_EMPTY_BODY = YES;
587 | CLANG_WARN_ENUM_CONVERSION = YES;
588 | CLANG_WARN_INFINITE_RECURSION = YES;
589 | CLANG_WARN_INT_CONVERSION = YES;
590 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
591 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
592 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
593 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
594 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
595 | CLANG_WARN_STRICT_PROTOTYPES = YES;
596 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
597 | CLANG_WARN_UNREACHABLE_CODE = YES;
598 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
599 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
600 | COPY_PHASE_STRIP = NO;
601 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
602 | ENABLE_NS_ASSERTIONS = NO;
603 | ENABLE_STRICT_OBJC_MSGSEND = YES;
604 | GCC_C_LANGUAGE_STANDARD = gnu99;
605 | GCC_NO_COMMON_BLOCKS = YES;
606 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
607 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
608 | GCC_WARN_UNDECLARED_SELECTOR = YES;
609 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
610 | GCC_WARN_UNUSED_FUNCTION = YES;
611 | GCC_WARN_UNUSED_VARIABLE = YES;
612 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
613 | MTL_ENABLE_DEBUG_INFO = NO;
614 | SDKROOT = iphoneos;
615 | SWIFT_COMPILATION_MODE = wholemodule;
616 | SWIFT_VERSION = "";
617 | TARGETED_DEVICE_FAMILY = "1,2";
618 | VALIDATE_PRODUCT = YES;
619 | };
620 | name = Release;
621 | };
622 | 36CC1C9C1B37083E009DE1F8 /* Debug */ = {
623 | isa = XCBuildConfiguration;
624 | buildSettings = {
625 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
626 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
627 | CODE_SIGN_IDENTITY = "iPhone Developer";
628 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
629 | CURRENT_PROJECT_VERSION = 3.13.0;
630 | FRAMEWORK_SEARCH_PATHS = (
631 | "$(inherited)",
632 | "$(PROJECT_DIR)/GCProgressSample",
633 | );
634 | INFOPLIST_FILE = GCProgressSample/Info.plist;
635 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
636 | MARKETING_VERSION = 3.13.0;
637 | PRODUCT_BUNDLE_IDENTIFIER = "com.keygraphix.ios.$(PRODUCT_NAME:rfc1034identifier)";
638 | PRODUCT_NAME = "$(TARGET_NAME)";
639 | PROVISIONING_PROFILE = "";
640 | PROVISIONING_PROFILE_SPECIFIER = "";
641 | SWIFT_VERSION = 5.0;
642 | };
643 | name = Debug;
644 | };
645 | 36CC1C9D1B37083E009DE1F8 /* Release */ = {
646 | isa = XCBuildConfiguration;
647 | buildSettings = {
648 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
649 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
650 | CODE_SIGN_IDENTITY = "iPhone Distribution";
651 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
652 | CURRENT_PROJECT_VERSION = 3.13.0;
653 | FRAMEWORK_SEARCH_PATHS = (
654 | "$(inherited)",
655 | "$(PROJECT_DIR)/GCProgressSample",
656 | );
657 | INFOPLIST_FILE = GCProgressSample/Info.plist;
658 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
659 | MARKETING_VERSION = 3.13.0;
660 | PRODUCT_BUNDLE_IDENTIFIER = "com.keygraphix.ios.$(PRODUCT_NAME:rfc1034identifier)";
661 | PRODUCT_NAME = "$(TARGET_NAME)";
662 | SWIFT_OPTIMIZATION_LEVEL = "-O";
663 | SWIFT_VERSION = 5.0;
664 | };
665 | name = Release;
666 | };
667 | 36CC1C9F1B37083E009DE1F8 /* Debug */ = {
668 | isa = XCBuildConfiguration;
669 | buildSettings = {
670 | BUNDLE_LOADER = "$(TEST_HOST)";
671 | FRAMEWORK_SEARCH_PATHS = "$(inherited)";
672 | GCC_PREPROCESSOR_DEFINITIONS = (
673 | "DEBUG=1",
674 | "$(inherited)",
675 | );
676 | INFOPLIST_FILE = GCProgressSampleTests/Info.plist;
677 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
678 | PRODUCT_BUNDLE_IDENTIFIER = "com.keygraphix.ios.$(PRODUCT_NAME:rfc1034identifier)";
679 | PRODUCT_NAME = "$(TARGET_NAME)";
680 | SWIFT_VERSION = 5.0;
681 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GCProgressSample.app/GCProgressSample";
682 | };
683 | name = Debug;
684 | };
685 | 36CC1CA01B37083E009DE1F8 /* Release */ = {
686 | isa = XCBuildConfiguration;
687 | buildSettings = {
688 | BUNDLE_LOADER = "$(TEST_HOST)";
689 | FRAMEWORK_SEARCH_PATHS = "$(inherited)";
690 | INFOPLIST_FILE = GCProgressSampleTests/Info.plist;
691 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
692 | PRODUCT_BUNDLE_IDENTIFIER = "com.keygraphix.ios.$(PRODUCT_NAME:rfc1034identifier)";
693 | PRODUCT_NAME = "$(TARGET_NAME)";
694 | SWIFT_OPTIMIZATION_LEVEL = "-O";
695 | SWIFT_VERSION = 5.0;
696 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/GCProgressSample.app/GCProgressSample";
697 | };
698 | name = Release;
699 | };
700 | 36F742D41B3A7016003D799C /* Debug */ = {
701 | isa = XCBuildConfiguration;
702 | buildSettings = {
703 | CLANG_ENABLE_MODULES = YES;
704 | CODE_SIGN_IDENTITY = "";
705 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
706 | CURRENT_PROJECT_VERSION = 3.13.0;
707 | DEFINES_MODULE = YES;
708 | DEVELOPMENT_TEAM = "";
709 | DYLIB_COMPATIBILITY_VERSION = 1;
710 | DYLIB_CURRENT_VERSION = 1;
711 | DYLIB_INSTALL_NAME_BASE = "@rpath";
712 | GCC_PREPROCESSOR_DEFINITIONS = (
713 | "DEBUG=1",
714 | "$(inherited)",
715 | );
716 | INFOPLIST_FILE = GradientCircularProgress/Info.plist;
717 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
718 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
719 | MARKETING_VERSION = 3.13.0;
720 | PRODUCT_BUNDLE_IDENTIFIER = "com.keygraphix.ios.$(PRODUCT_NAME:rfc1034identifier)";
721 | PRODUCT_NAME = "$(TARGET_NAME)";
722 | SKIP_INSTALL = YES;
723 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
724 | SWIFT_VERSION = 5.0;
725 | VERSIONING_SYSTEM = "apple-generic";
726 | VERSION_INFO_PREFIX = "";
727 | };
728 | name = Debug;
729 | };
730 | 36F742D51B3A7016003D799C /* Release */ = {
731 | isa = XCBuildConfiguration;
732 | buildSettings = {
733 | CLANG_ENABLE_MODULES = YES;
734 | CODE_SIGN_IDENTITY = "";
735 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
736 | CURRENT_PROJECT_VERSION = 3.13.0;
737 | DEFINES_MODULE = YES;
738 | DEVELOPMENT_TEAM = "";
739 | DYLIB_COMPATIBILITY_VERSION = 1;
740 | DYLIB_CURRENT_VERSION = 1;
741 | DYLIB_INSTALL_NAME_BASE = "@rpath";
742 | INFOPLIST_FILE = GradientCircularProgress/Info.plist;
743 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
744 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
745 | MARKETING_VERSION = 3.13.0;
746 | PRODUCT_BUNDLE_IDENTIFIER = "com.keygraphix.ios.$(PRODUCT_NAME:rfc1034identifier)";
747 | PRODUCT_NAME = "$(TARGET_NAME)";
748 | SKIP_INSTALL = YES;
749 | SWIFT_OPTIMIZATION_LEVEL = "-O";
750 | SWIFT_VERSION = 5.0;
751 | VERSIONING_SYSTEM = "apple-generic";
752 | VERSION_INFO_PREFIX = "";
753 | };
754 | name = Release;
755 | };
756 | /* End XCBuildConfiguration section */
757 |
758 | /* Begin XCConfigurationList section */
759 | 36CC1C771B37083E009DE1F8 /* Build configuration list for PBXProject "GCProgressSample" */ = {
760 | isa = XCConfigurationList;
761 | buildConfigurations = (
762 | 36CC1C991B37083E009DE1F8 /* Debug */,
763 | 36CC1C9A1B37083E009DE1F8 /* Release */,
764 | );
765 | defaultConfigurationIsVisible = 0;
766 | defaultConfigurationName = Release;
767 | };
768 | 36CC1C9B1B37083E009DE1F8 /* Build configuration list for PBXNativeTarget "GCProgressSample" */ = {
769 | isa = XCConfigurationList;
770 | buildConfigurations = (
771 | 36CC1C9C1B37083E009DE1F8 /* Debug */,
772 | 36CC1C9D1B37083E009DE1F8 /* Release */,
773 | );
774 | defaultConfigurationIsVisible = 0;
775 | defaultConfigurationName = Release;
776 | };
777 | 36CC1C9E1B37083E009DE1F8 /* Build configuration list for PBXNativeTarget "GCProgressSampleTests" */ = {
778 | isa = XCConfigurationList;
779 | buildConfigurations = (
780 | 36CC1C9F1B37083E009DE1F8 /* Debug */,
781 | 36CC1CA01B37083E009DE1F8 /* Release */,
782 | );
783 | defaultConfigurationIsVisible = 0;
784 | defaultConfigurationName = Release;
785 | };
786 | 36F742D81B3A7016003D799C /* Build configuration list for PBXNativeTarget "GradientCircularProgress" */ = {
787 | isa = XCConfigurationList;
788 | buildConfigurations = (
789 | 36F742D41B3A7016003D799C /* Debug */,
790 | 36F742D51B3A7016003D799C /* Release */,
791 | );
792 | defaultConfigurationIsVisible = 0;
793 | defaultConfigurationName = Release;
794 | };
795 | /* End XCConfigurationList section */
796 | };
797 | rootObject = 36CC1C741B37083E009DE1F8 /* Project object */;
798 | }
799 |
--------------------------------------------------------------------------------