diff --git a/CustomView.xcodeproj/project.pbxproj b/CustomView.xcodeproj/project.pbxproj index 73ab43a..800feac 100644 --- a/CustomView.xcodeproj/project.pbxproj +++ b/CustomView.xcodeproj/project.pbxproj @@ -15,6 +15,7 @@ 92949A602295DBF8008EE240 /* ProgressCircleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92949A5F2295DBF8008EE240 /* ProgressCircleView.swift */; }; 92949A622295E067008EE240 /* ProgressBarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92949A612295E067008EE240 /* ProgressBarView.swift */; }; 92FB2169229A55C5000AF93E /* ProgressBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92FB2168229A55C5000AF93E /* ProgressBarViewController.swift */; }; + A45D2903229ED1B400B3D967 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = A45D2902229ED1B400B3D967 /* Constants.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -28,6 +29,7 @@ 92949A5F2295DBF8008EE240 /* ProgressCircleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressCircleView.swift; sourceTree = ""; }; 92949A612295E067008EE240 /* ProgressBarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarView.swift; sourceTree = ""; }; 92FB2168229A55C5000AF93E /* ProgressBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarViewController.swift; sourceTree = ""; }; + A45D2902229ED1B400B3D967 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -76,6 +78,7 @@ 92949A532295DAF7008EE240 /* Assets.xcassets */, 92949A552295DAF7008EE240 /* LaunchScreen.storyboard */, 92949A582295DAF7008EE240 /* Info.plist */, + A45D2902229ED1B400B3D967 /* Constants.swift */, ); path = CustomView; sourceTree = ""; @@ -165,6 +168,7 @@ 92FB2169229A55C5000AF93E /* ProgressBarViewController.swift in Sources */, 92949A602295DBF8008EE240 /* ProgressCircleView.swift in Sources */, 92949A4D2295DAF3008EE240 /* AppDelegate.swift in Sources */, + A45D2903229ED1B400B3D967 /* Constants.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -311,7 +315,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 34E95R7U23; + DEVELOPMENT_TEAM = L76X5KFZD9; INFOPLIST_FILE = CustomView/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", @@ -329,7 +333,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = 34E95R7U23; + DEVELOPMENT_TEAM = L76X5KFZD9; INFOPLIST_FILE = CustomView/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/CustomView.xcodeproj/project.xcworkspace/xcuserdata/carneiro.xcuserdatad/UserInterfaceState.xcuserstate b/CustomView.xcodeproj/project.xcworkspace/xcuserdata/carneiro.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..08867d2 Binary files /dev/null and b/CustomView.xcodeproj/project.xcworkspace/xcuserdata/carneiro.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/CustomView.xcodeproj/xcuserdata/carneiro.xcuserdatad/xcschemes/xcschememanagement.plist b/CustomView.xcodeproj/xcuserdata/carneiro.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..2a99e1a --- /dev/null +++ b/CustomView.xcodeproj/xcuserdata/carneiro.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,14 @@ + + + + + SchemeUserState + + CustomView.xcscheme_^#shared#^_ + + orderHint + 0 + + + + diff --git a/CustomView/Base.lproj/Main.storyboard b/CustomView/Base.lproj/Main.storyboard index 4b8cb5b..23af2da 100644 --- a/CustomView/Base.lproj/Main.storyboard +++ b/CustomView/Base.lproj/Main.storyboard @@ -58,7 +58,7 @@ - + @@ -67,22 +67,94 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -197,6 +269,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -206,7 +388,13 @@ + + + + + + @@ -385,6 +573,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -394,7 +692,9 @@ + + diff --git a/CustomView/Constants.swift b/CustomView/Constants.swift new file mode 100644 index 0000000..746a9bf --- /dev/null +++ b/CustomView/Constants.swift @@ -0,0 +1,20 @@ +// +// Helper.swift +// CustomView +// +// Created by Artur Carneiro on 29/05/19. +// Copyright © 2019 Joaquim Pessoa Filho. All rights reserved. +// + +import Foundation +import UIKit + +enum ColorPallete { + static let red = #colorLiteral(red: 0.9764705882, green: 0.3411764706, blue: 0.2196078431, alpha: 1) + static let orange = #colorLiteral(red: 0.9764705882, green: 0.5333333333, blue: 0.2117647059, alpha: 1) + static let yellow = #colorLiteral(red: 0.9764705882, green: 0.7607843137, blue: 0.2117647059, alpha: 1) + static let green = #colorLiteral(red: 0.737254902, green: 0.9764705882, blue: 0.2117647059, alpha: 1) + static let blue = #colorLiteral(red: 0.2117647059, green: 0.9764705882, blue: 0.9254901961, alpha: 1) + static let indigo = #colorLiteral(red: 0.2117647059, green: 0.568627451, blue: 0.9764705882, alpha: 1) + static let violet = #colorLiteral(red: 0.5843137255, green: 0.2117647059, blue: 0.9764705882, alpha: 1) +} diff --git a/CustomView/Controllers/ProgressBarViewController.swift b/CustomView/Controllers/ProgressBarViewController.swift index 7c56694..6648f58 100644 --- a/CustomView/Controllers/ProgressBarViewController.swift +++ b/CustomView/Controllers/ProgressBarViewController.swift @@ -15,12 +15,20 @@ class ProgressBarViewController: UITableViewController { @IBOutlet weak var progressSlider: UISlider! @IBOutlet weak var targetSlider: UISlider! + @IBOutlet weak var progressSegmentedColorPicker: UISegmentedControl! + @IBOutlet weak var targetSegmentedColorPicker: UISegmentedControl! + + private var colorArray : [UIColor] = [ColorPallete.red, ColorPallete.orange, ColorPallete.yellow, ColorPallete.green, ColorPallete.blue, ColorPallete.indigo, ColorPallete.violet] + override func viewDidLoad() { super.viewDidLoad() self.progressBarView?.lineWidth = CGFloat(self.widthSlider.value) self.progressBarView?.progressValue = CGFloat(self.progressSlider.value) self.progressBarView?.targetValue = CGFloat(self.targetSlider.value) + + colorPickerApply(on: progressSegmentedColorPicker) + colorPickerApply(on: targetSegmentedColorPicker) } override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) { @@ -40,5 +48,28 @@ class ProgressBarViewController: UITableViewController { @IBAction func targetChange(_ sender: Any) { self.progressBarView?.targetValue = CGFloat(self.targetSlider.value) } + + @IBAction func changeProgressColor(_ sender: UISegmentedControl) { + + progressBarView?.progressColor = colorArray[sender.selectedSegmentIndex] + progressSlider.tintColor = colorArray[sender.selectedSegmentIndex] + + } + + @IBAction func changeTargetColor(_ sender: UISegmentedControl) { + + progressBarView?.targetColor = colorArray[sender.selectedSegmentIndex] + targetSlider.tintColor = colorArray[sender.selectedSegmentIndex] + + } + + func colorPickerApply(on segmented : UISegmentedControl) { + + for i in 0..