16 Commits

Author SHA1 Message Date
Hamza Ghazouani c89c6e7250 a try to fix the issue of interface builder when we use carthage 2019-10-21 22:09:03 +02:00
Hamza Ghazouani 1b31f26226 Fix the issue #31: the thumb jumps when the minimumValue > 0 (#58) 2019-10-21 00:38:06 +02:00
Hamza Ghazouani 511b62e870 Update ISSUE_TEMPLATE.md 2019-10-13 22:41:09 +02:00
Hamza Ghazouani 83ea6b0f30 Update ISSUE_TEMPLATE.md 2019-10-13 22:34:52 +02:00
Hamza Ghazouani 355c838a84 Update README.md 2019-10-13 22:33:41 +02:00
Hamza Ghazouani 5d24b423c0 Update CONTRIBUTING.md 2019-10-13 22:33:01 +02:00
Hamza Ghazouani 10ea8fd1cb Update FUNDING.yml 2019-10-13 22:25:49 +02:00
Hamza Ghazouani 941c58ff51 Update CHANGELOG.md 2019-07-29 22:13:43 +02:00
Hamza Ghazouani d38b82c204 Push new version 2019-07-29 00:35:17 +02:00
Hamza Ghazouani 433de29f6e Fix warning in the example project 2019-07-29 00:34:12 +02:00
ShanghaiTimes 892d1002a5 Update to swift 5 & update PlayerViewController.swift (#48)
Update the project to swift 5 and change a deprecated method in the player
2019-07-27 15:52:46 +02:00
Hamza Ghazouani a19a4fcf6c Fix the issue of tracking when the value is equal to the max value and add tests for this part 2019-07-27 15:02:07 +02:00
Christos Koninis 93fb96cf68 Added option to stop thumb looping over the min/max value (#53)
Add option to stop thumb looping over the min/max value
2019-07-24 10:43:11 +01:00
Hamza Ghazouani 5ae6977456 Refactor thumbs drawing 2019-07-24 10:18:12 +01:00
Christos Koninis 1cf18763eb Added thumb offset option (#52)
Add the option to draw the thumb inside or outside the circle
2019-07-24 00:54:20 +01:00
Hamza Ghazouani 6512f79197 Create FUNDING.yml 2019-05-28 21:33:02 +02:00
40 changed files with 1059 additions and 584 deletions
+2
View File
@@ -0,0 +1,2 @@
exclude_patterns:
- "Example/"
+1
View File
@@ -0,0 +1 @@
github: HamzaGhazouani
+2 -2
View File
@@ -1,2 +1,2 @@
<!-- Love HGCircularSlider? Please consider supporting our collective:
👉 https://opencollective.com/HGCircularSlider/donate -->
<!-- Love HGCircularSlider? please consider sponsoring me so I can continue maintaining and evolving all my projects and new ones. 😄 ✨🏎
👉 https://github.com/users/HamzaGhazouani/sponsorship -->
+1 -1
View File
@@ -1,7 +1,7 @@
language: objective-c
os: osx
osx_image:
- xcode10.1
- xcode10.2
env:
global:
+6
View File
@@ -1,6 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file.
## [2.2.0](https://github.com/HamzaGhazouani/HGCircularSlider/releases/tag/2.2.0)
* Support Swift 5
* Fix the tracking when the value is equal to the max
* Add option to stop thumb looping over the min/max value
* Add offset thumb option, to draw the thumb inside or outside the circle
## [2.1.0](https://github.com/HamzaGhazouani/HGCircularSlider/releases/tag/2.1.0)
* Support Swift 4.2 version
-43
View File
@@ -9,7 +9,6 @@ We welcome any type of contribution, not only code. You can help with
- **Marketing**: writing blog posts, howto's, printing stickers, ...
- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ...
- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them.
- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/HGCircularSlider).
## Your First Contribution
@@ -23,45 +22,3 @@ Any code change should be submitted as a pull request. The description should ex
The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge.
It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you?
## Financial contributions
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/HGCircularSlider).
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
## Questions
If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!).
You can also reach us at hello@HGCircularSlider.opencollective.com.
## Credits
### Contributors
Thank you to all the people who have already contributed to HGCircularSlider!
<a href="graphs/contributors"><img src="https://opencollective.com/HGCircularSlider/contributors.svg?width=890" /></a>
### Backers
Thank you to all our backers! [[Become a backer](https://opencollective.com/HGCircularSlider#backer)]
<a href="https://opencollective.com/HGCircularSlider#backers" target="_blank"><img src="https://opencollective.com/HGCircularSlider/backers.svg?width=890"></a>
### Sponsors
Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/HGCircularSlider#sponsor))
<a href="https://opencollective.com/HGCircularSlider/sponsor/0/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/1/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/2/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/3/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/4/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/5/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/6/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/7/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/8/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/9/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/9/avatar.svg"></a>
<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->
@@ -19,6 +19,8 @@
607FACDD1AFB9204008FA782 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDC1AFB9204008FA782 /* Images.xcassets */; };
607FACE01AFB9204008FA782 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 607FACDE1AFB9204008FA782 /* LaunchScreen.xib */; };
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACEB1AFB9204008FA782 /* Tests.swift */; };
BB409EA9235C82CE006DC844 /* CircularSliderHelperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB409EA7235C82CA006DC844 /* CircularSliderHelperTests.swift */; };
BB409EAB235C8ACE006DC844 /* CircularSliderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB409EAA235C8ACE006DC844 /* CircularSliderTests.swift */; };
BDF84380A076F46A79D0C634 /* Pods_HGCircularSlider_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 41A4019E034E0265198683A8 /* Pods_HGCircularSlider_Example.framework */; };
/* End PBXBuildFile section */
@@ -55,6 +57,8 @@
6C7918EC49141F7F4652E8F1 /* Pods_HGCircularSlider_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_HGCircularSlider_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
99A3B0410141275989079EB6 /* Pods-HGCircularSlider_Tests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HGCircularSlider_Tests.release.xcconfig"; path = "Pods/Target Support Files/Pods-HGCircularSlider_Tests/Pods-HGCircularSlider_Tests.release.xcconfig"; sourceTree = "<group>"; };
9BA305BCC009CE17283FE799 /* Pods-HGCircularSlider_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HGCircularSlider_Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-HGCircularSlider_Example/Pods-HGCircularSlider_Example.release.xcconfig"; sourceTree = "<group>"; };
BB409EA7235C82CA006DC844 /* CircularSliderHelperTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CircularSliderHelperTests.swift; sourceTree = "<group>"; };
BB409EAA235C8ACE006DC844 /* CircularSliderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CircularSliderTests.swift; sourceTree = "<group>"; };
E7D1A678D25EC3365B800DB3 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
EEE4816CB037512E066C24A8 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -141,6 +145,8 @@
607FACE81AFB9204008FA782 /* Tests */ = {
isa = PBXGroup;
children = (
BB409EA7235C82CA006DC844 /* CircularSliderHelperTests.swift */,
BB409EAA235C8ACE006DC844 /* CircularSliderTests.swift */,
607FACEB1AFB9204008FA782 /* Tests.swift */,
607FACE91AFB9204008FA782 /* Supporting Files */,
);
@@ -227,14 +233,14 @@
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = BKKRU5K7TG;
LastSwiftMigration = 1000;
ProvisioningStyle = Manual;
DevelopmentTeam = 62L4CLZDFB;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = FP33JJN6C2;
LastSwiftMigration = 1000;
DevelopmentTeam = 62L4CLZDFB;
LastSwiftMigration = 1020;
ProvisioningStyle = Manual;
TestTargetID = 607FACCF1AFB9204008FA782;
};
@@ -242,7 +248,7 @@
};
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "HGCircularSlider" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
@@ -305,7 +311,7 @@
files = (
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-HGCircularSlider_Example/Pods-HGCircularSlider_Example-frameworks.sh",
"${PODS_ROOT}/Target Support Files/Pods-HGCircularSlider_Example/Pods-HGCircularSlider_Example-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/HGCircularSlider/HGCircularSlider.framework",
);
name = "[CP] Embed Pods Frameworks";
@@ -314,7 +320,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-HGCircularSlider_Example/Pods-HGCircularSlider_Example-frameworks.sh\"\n";
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-HGCircularSlider_Example/Pods-HGCircularSlider_Example-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
E9C30214565096BEB7531CD5 /* [CP] Check Pods Manifest.lock */ = {
@@ -356,6 +362,8 @@
buildActionMask = 2147483647;
files = (
607FACEC1AFB9204008FA782 /* Tests.swift in Sources */,
BB409EAB235C8ACE006DC844 /* CircularSliderTests.swift in Sources */,
BB409EA9235C82CE006DC844 /* CircularSliderHelperTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -435,7 +443,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -482,7 +490,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -496,17 +504,20 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
DEVELOPMENT_TEAM = BKKRU5K7TG;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=*]" = 62L4CLZDFB;
INFOPLIST_FILE = HGCircularSlider/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "com.onmobile.HGCircularSlider-Example";
PRODUCT_BUNDLE_IDENTIFIER = "robert-chalmers.uk.HGCircularSlider-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "979b7b1f-969d-43fe-82ea-a1cc58ec7aab";
PROVISIONING_PROFILE_SPECIFIER = "OM-Ent Generic Universal Distribution";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
"PROVISIONING_PROFILE[arch=*]" = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -516,16 +527,20 @@
buildSettings = {
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=*]" = 62L4CLZDFB;
INFOPLIST_FILE = HGCircularSlider/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
PRODUCT_BUNDLE_IDENTIFIER = "com.onmobile.HGCircularSlider-Example";
PRODUCT_BUNDLE_IDENTIFIER = "robert-chalmers.uk.HGCircularSlider-Example";
PRODUCT_NAME = "$(TARGET_NAME)";
"PROVISIONING_PROFILE[arch=*]" = "";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
};
name = Release;
};
@@ -534,7 +549,7 @@
baseConfigurationReference = 2A9608AFE40174911E5079C3 /* Pods-HGCircularSlider_Tests.debug.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = FP33JJN6C2;
DEVELOPMENT_TEAM = 62L4CLZDFB;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
@@ -544,8 +559,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HGCircularSlider_Example.app/HGCircularSlider_Example";
};
name = Debug;
@@ -555,14 +569,13 @@
baseConfigurationReference = 99A3B0410141275989079EB6 /* Pods-HGCircularSlider_Tests.release.xcconfig */;
buildSettings = {
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 62L4CLZDFB;
INFOPLIST_FILE = Tests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/HGCircularSlider_Example.app/HGCircularSlider_Example";
};
name = Release;
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1110"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -41,6 +41,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "HGCircularSlider_Example.app"
BlueprintName = "HGCircularSlider_Example"
ReferencedContainer = "container:HGCircularSlider.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
@@ -53,17 +62,6 @@
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "607FACCF1AFB9204008FA782"
BuildableName = "HGCircularSlider_Example.app"
BlueprintName = "HGCircularSlider_Example"
ReferencedContainer = "container:HGCircularSlider.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -85,8 +83,6 @@
ReferencedContainer = "container:HGCircularSlider.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -39,6 +39,11 @@
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
@@ -120,7 +120,7 @@ class PlayerViewController: UIViewController {
@objc func playerItemDidReachEnd(_ notification: Notification) {
if let playerItem: AVPlayerItem = notification.object as? AVPlayerItem {
playerItem.seek(to: CMTime.zero)
playerItem.seek(to: CMTime.zero, toleranceBefore: CMTime.zero, toleranceAfter: CMTime.zero,completionHandler:nil)
playerSegmentedControl.selectedSegmentIndex = UISegmentedControl.noSegment
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
use_frameworks!
platform :ios, '9.0'
platform :ios, '12.0'
target 'HGCircularSlider_Example' do
pod 'HGCircularSlider', :path => '../'
+4 -4
View File
@@ -1,5 +1,5 @@
PODS:
- HGCircularSlider (2.1.0)
- HGCircularSlider (2.2.0)
DEPENDENCIES:
- HGCircularSlider (from `../`)
@@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
HGCircularSlider: efaff4ec1b6eae905519440775e5088f4a0455ef
HGCircularSlider: afb1942743a2df156dcc7a3500216e523e14266b
PODFILE CHECKSUM: ea58587f670c5d07b17de771dcc7a8944f82a3aa
PODFILE CHECKSUM: 5935efe45bed5ee625cec9162a170ce99849ca5c
COCOAPODS: 1.5.3
COCOAPODS: 1.7.5
+5 -3
View File
@@ -1,7 +1,8 @@
{
"name": "HGCircularSlider",
"version": "2.1.0",
"version": "2.2.0",
"summary": "Multiple Circular Sliders used to select a value from a continuous range of values.",
"swift_versions": "5.0",
"description": "Circular Sliders used to select a value from a continuous range of values.\n\nCircularSlider: simple circular slider\nRangeCircularSlider: slider with two points to select a range of values from a continuous range of values\nMidPointCircularSlider: slider with fixed range to select a range of values from a continuois range of values",
"homepage": "https://github.com/HamzaGhazouani/HGCircularSlider",
"license": {
@@ -13,11 +14,12 @@
},
"source": {
"git": "https://github.com/HamzaGhazouani/HGCircularSlider.git",
"tag": "2.1.0"
"tag": "2.2.0"
},
"social_media_url": "https://twitter.com/GhazouaniHamza",
"platforms": {
"ios": "8.0"
},
"source_files": "HGCircularSlider/Classes/**/*"
"source_files": "HGCircularSlider/Classes/**/*",
"swift_version": "5.0"
}
+4 -4
View File
@@ -1,5 +1,5 @@
PODS:
- HGCircularSlider (2.1.0)
- HGCircularSlider (2.2.0)
DEPENDENCIES:
- HGCircularSlider (from `../`)
@@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../"
SPEC CHECKSUMS:
HGCircularSlider: efaff4ec1b6eae905519440775e5088f4a0455ef
HGCircularSlider: afb1942743a2df156dcc7a3500216e523e14266b
PODFILE CHECKSUM: ea58587f670c5d07b17de771dcc7a8944f82a3aa
PODFILE CHECKSUM: 5935efe45bed5ee625cec9162a170ce99849ca5c
COCOAPODS: 1.5.3
COCOAPODS: 1.7.5
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
@@ -1,6 +1,6 @@
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
@@ -3,10 +3,15 @@ set -e
set -u
set -o pipefail
function on_error {
echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
}
trap 'on_error $LINENO' ERR
if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
# frameworks to, so exit 0 (signalling the script phase was successful).
exit 0
# If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
# frameworks to, so exit 0 (signalling the script phase was successful).
exit 0
fi
echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
@@ -36,8 +41,8 @@ install_framework()
local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
if [ -L "${source}" ]; then
echo "Symlinked..."
source="$(readlink "${source}")"
echo "Symlinked..."
source="$(readlink "${source}")"
fi
# Use filter instead of exclude so missing patterns don't throw errors.
@@ -47,8 +52,13 @@ install_framework()
local basename
basename="$(basename -s .framework "$1")"
binary="${destination}/${basename}.framework/${basename}"
if ! [ -r "$binary" ]; then
binary="${destination}/${basename}"
elif [ -L "${binary}" ]; then
echo "Destination binary is symlinked..."
dirname="$(dirname "${binary}")"
binary="${dirname}/$(readlink "${binary}")"
fi
# Strip invalid architectures so "fat" simulator / device frameworks work on device
@@ -62,7 +72,7 @@ install_framework()
# Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
local swift_runtime_libs
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]})
swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
for lib in $swift_runtime_libs; do
echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
@@ -84,7 +94,7 @@ install_dsym() {
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
strip_invalid_archs "$binary"
fi
@@ -99,10 +109,18 @@ install_dsym() {
fi
}
# Copies the bcsymbolmap files of a vendored framework
install_bcsymbolmap() {
local bcsymbolmap_path="$1"
local destination="${BUILT_PRODUCTS_DIR}"
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identitiy
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
# Use the current code_sign_identity
echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
@@ -131,7 +149,7 @@ strip_invalid_archs() {
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
lipo -remove "$arch" -output "$binary" "$binary"
stripped="$stripped $arch"
fi
done
@@ -1,10 +1,10 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider/HGCircularSlider.framework/Headers"
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider/HGCircularSlider.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "HGCircularSlider"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
@@ -1,10 +1,10 @@
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider/HGCircularSlider.framework/Headers"
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider/HGCircularSlider.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "HGCircularSlider"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>${CURRENT_PROJECT_VERSION}</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
@@ -1,7 +1,7 @@
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider/HGCircularSlider.framework/Headers"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider/HGCircularSlider.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "HGCircularSlider"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
@@ -1,7 +1,7 @@
FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider"
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider/HGCircularSlider.framework/Headers"
HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/HGCircularSlider/HGCircularSlider.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "HGCircularSlider"
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
@@ -0,0 +1,72 @@
//
// CircularSliderHelperTests.swift
// HGCircularSlider_Tests
//
// Created by Hamza GHAZOUANI on 24/07/2019.
// Copyright © 2019 CocoaPods. All rights reserved.
//
import XCTest
@testable import HGCircularSlider
extension CGFloat {
var toDegrees: CGFloat {
return self * 180.0 / CGFloat(Double.pi)
}
}
class CircularSliderHelperTests: XCTestCase {
let cirlceInterval = Interval(min: 0 , max: CGFloat(2 * Double.pi))
let valuesInterval = Interval(min: 0, max: 1.2)
func testInitialValueScale() {
// Given
let value = valuesInterval.min
// Thene
let angle = CircularSliderHelper.scaleValue(value, fromInterval: valuesInterval, toInterval: cirlceInterval).toDegrees
XCTAssertEqual(angle, 0)
}
func testFinalValueScale() {
// Given
let value: CGFloat = valuesInterval.max
// Thene
let angle = CircularSliderHelper.scaleValue(value, fromInterval: valuesInterval, toInterval: cirlceInterval).toDegrees
XCTAssertEqual(angle, 360)
}
func testMedianValueScale() {
// Given
let value: CGFloat = valuesInterval.max / 2
// Thene
let angle = CircularSliderHelper.scaleValue(value, fromInterval: valuesInterval, toInterval: cirlceInterval).toDegrees
XCTAssertEqual(angle, 180)
}
func testValueFromRangeToAnotherRangeMinValueEqualToZero() {
let oldRange = Interval(min: 0, max: 100)
let newRange = Interval(min: 10, max: 20)
let value: CGFloat = 10
let newValue = CircularSliderHelper.scaleValue(value, fromInterval: oldRange, toInterval: newRange)
XCTAssertEqual(newValue, 11)
}
func testValueFromRangeToAnotherRangeMinValueGratherThanZero() {
let oldRange = Interval(min: 5, max: 30)
let newRange = Interval(min: 0, max: 100)
let value: CGFloat = 10
let newValue = CircularSliderHelper.scaleValue(value, fromInterval: oldRange, toInterval: newRange)
XCTAssertEqual(newValue, 20)
}
}
+98
View File
@@ -0,0 +1,98 @@
//
// CircularSliderTests.swift
// HGCircularSlider_Tests
//
// Created by Hamza on 20/10/2019.
// Copyright © 2019 CocoaPods. All rights reserved.
//
import XCTest
@testable import HGCircularSlider
class CircularSliderTests: XCTestCase {
func testEndPointPositionWithZeroAsInitialValueAnd90DegreesAsTouchPosition() {
// Given
let circularSlider = CircularSlider(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
let startPosition = CGPoint(x: 25, y: 0)
circularSlider.minimumValue = 0
circularSlider.maximumValue = 100
circularSlider.endPointValue = 0
let touchPosition = CGPoint(x: 50, y: 25)
// When
let newValue = circularSlider.newValue(from: circularSlider.endPointValue, touch: touchPosition, start: startPosition)
// Then
XCTAssertEqual(newValue, 25, accuracy: 0.001)
}
func testEndPointPositionWithValueGratherThanZeroAsInitialValueAnd90DegreesAsTouchPosition() {
// Given
let circularSlider = CircularSlider(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
let startPosition = CGPoint(x: 25, y: 0)
circularSlider.minimumValue = 5
circularSlider.maximumValue = 25
circularSlider.endPointValue = 5
let touchPosition = CGPoint(x: 50, y: 25)
// When
let newValue = circularSlider.newValue(from: circularSlider.endPointValue, touch: touchPosition, start: startPosition)
// Then
XCTAssertEqual(newValue, 10, accuracy: 0.001)
}
func testndPointPositionWithValueGratherThanZeroAsInitialValueAnd180DegreesAsTouchPosition() {
// Given
let circularSlider = CircularSlider(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
let startPosition = CGPoint(x: 25, y: 0)
circularSlider.minimumValue = 5
circularSlider.maximumValue = 25
circularSlider.endPointValue = 10
let touchPosition = CGPoint(x: 25, y: 50)
// When
let newValue = circularSlider.newValue(from: circularSlider.endPointValue, touch: touchPosition, start: startPosition)
// Then
XCTAssertEqual(newValue, 15, accuracy: 0.001)
}
func testndPointPositionWithValueGratherThanZeroAsInitialValueAnd270DegreesAsTouchPosition() {
// Given
let circularSlider = CircularSlider(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
let startPosition = CGPoint(x: 25, y: 0)
circularSlider.minimumValue = 5
circularSlider.maximumValue = 25
circularSlider.endPointValue = 10
let touchPosition = CGPoint(x: 0, y: 25)
// When
let newValue = circularSlider.newValue(from: circularSlider.endPointValue, touch: touchPosition, start: startPosition)
// Then
XCTAssertEqual(newValue, 20, accuracy: 0.001)
}
func testndPointPositionWithValueGratherThanZeroAsInitialValueAnd360DegreesAsTouchPosition() {
// Given
let circularSlider = CircularSlider(frame: CGRect(x: 0, y: 0, width: 50, height: 50))
let startPosition = CGPoint(x: 25, y: 0)
circularSlider.minimumValue = 5
circularSlider.maximumValue = 25
circularSlider.endPointValue = 10
let touchPosition = CGPoint(x: 24.999, y: 0)
// When
let newValue = circularSlider.newValue(from: circularSlider.endPointValue, touch: touchPosition, start: startPosition)
// Then
XCTAssertEqual(newValue, 25, accuracy: 0.001)
}
}
+2 -2
View File
@@ -8,9 +8,9 @@
Pod::Spec.new do |s|
s.name = 'HGCircularSlider'
s.version = '2.1.0'
s.version = '2.2.0'
s.summary = 'Multiple Circular Sliders used to select a value from a continuous range of values.'
s.swift_version = '4.2'
s.swift_version = '5.0'
s.description = <<-DESC
Circular Sliders used to select a value from a continuous range of values.
+168 -4
View File
@@ -7,6 +7,13 @@
objects = {
/* Begin PBXBuildFile section */
BB692D2E235C9EB300CB74DA /* HGCircularSliderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB692D2D235C9EB300CB74DA /* HGCircularSliderTests.swift */; };
BB692D30235C9EB300CB74DA /* HGCircularSlider.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CCDBFDDB1E43366F005D6F08 /* HGCircularSlider.framework */; };
BB692D37235C9F1100CB74DA /* CircularSliderHelperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB692D36235C9F1100CB74DA /* CircularSliderHelperTests.swift */; };
BB692D39235C9F1C00CB74DA /* CircularSliderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB692D38235C9F1C00CB74DA /* CircularSliderTests.swift */; };
BB692D3D235E473800CB74DA /* CircularSlider.swift in Headers */ = {isa = PBXBuildFile; fileRef = CCDBFDFA1E4336C9005D6F08 /* CircularSlider.swift */; settings = {ATTRIBUTES = (Public, ); }; };
BB692D3E235E473B00CB74DA /* MidPointCircularSlider.swift in Headers */ = {isa = PBXBuildFile; fileRef = CCCC96451E9F7FD000999D34 /* MidPointCircularSlider.swift */; settings = {ATTRIBUTES = (Public, ); }; };
BB692D3F235E474000CB74DA /* RangeCircularSlider.swift in Headers */ = {isa = PBXBuildFile; fileRef = CCDBFDFC1E4336C9005D6F08 /* RangeCircularSlider.swift */; settings = {ATTRIBUTES = (Public, ); }; };
CCCC96461E9F7FD000999D34 /* MidPointCircularSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCCC96451E9F7FD000999D34 /* MidPointCircularSlider.swift */; };
CCDBFDE01E43366F005D6F08 /* HGCircularSlider.h in Headers */ = {isa = PBXBuildFile; fileRef = CCDBFDDE1E43366F005D6F08 /* HGCircularSlider.h */; settings = {ATTRIBUTES = (Public, ); }; };
CCDBFDFD1E4336C9005D6F08 /* .gitkeep in Resources */ = {isa = PBXBuildFile; fileRef = CCDBFDF61E4336C9005D6F08 /* .gitkeep */; };
@@ -16,7 +23,22 @@
CCDBFE021E4336C9005D6F08 /* RangeCircularSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCDBFDFC1E4336C9005D6F08 /* RangeCircularSlider.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
BB692D31235C9EB300CB74DA /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = CCDBFDD21E43366F005D6F08 /* Project object */;
proxyType = 1;
remoteGlobalIDString = CCDBFDDA1E43366F005D6F08;
remoteInfo = HGCircularSlider;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
BB692D2B235C9EB300CB74DA /* HGCircularSliderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HGCircularSliderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
BB692D2D235C9EB300CB74DA /* HGCircularSliderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HGCircularSliderTests.swift; sourceTree = "<group>"; };
BB692D2F235C9EB300CB74DA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
BB692D36235C9F1100CB74DA /* CircularSliderHelperTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CircularSliderHelperTests.swift; path = Example/Tests/CircularSliderHelperTests.swift; sourceTree = SOURCE_ROOT; };
BB692D38235C9F1C00CB74DA /* CircularSliderTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CircularSliderTests.swift; path = Example/Tests/CircularSliderTests.swift; sourceTree = SOURCE_ROOT; };
CCCC96451E9F7FD000999D34 /* MidPointCircularSlider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MidPointCircularSlider.swift; sourceTree = "<group>"; };
CCDBFDDB1E43366F005D6F08 /* HGCircularSlider.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = HGCircularSlider.framework; sourceTree = BUILT_PRODUCTS_DIR; };
CCDBFDDE1E43366F005D6F08 /* HGCircularSlider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HGCircularSlider.h; sourceTree = "<group>"; };
@@ -29,6 +51,14 @@
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
BB692D28235C9EB300CB74DA /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
BB692D30235C9EB300CB74DA /* HGCircularSlider.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
CCDBFDD71E43366F005D6F08 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
@@ -39,10 +69,22 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
BB692D2C235C9EB300CB74DA /* HGCircularSliderTests */ = {
isa = PBXGroup;
children = (
BB692D36235C9F1100CB74DA /* CircularSliderHelperTests.swift */,
BB692D38235C9F1C00CB74DA /* CircularSliderTests.swift */,
BB692D2D235C9EB300CB74DA /* HGCircularSliderTests.swift */,
BB692D2F235C9EB300CB74DA /* Info.plist */,
);
path = HGCircularSliderTests;
sourceTree = "<group>";
};
CCDBFDD11E43366F005D6F08 = {
isa = PBXGroup;
children = (
CCDBFDDD1E43366F005D6F08 /* HGCircularSlider */,
BB692D2C235C9EB300CB74DA /* HGCircularSliderTests */,
CCDBFDDC1E43366F005D6F08 /* Products */,
);
sourceTree = "<group>";
@@ -51,6 +93,7 @@
isa = PBXGroup;
children = (
CCDBFDDB1E43366F005D6F08 /* HGCircularSlider.framework */,
BB692D2B235C9EB300CB74DA /* HGCircularSliderTests.xctest */,
);
name = Products;
sourceTree = "<group>";
@@ -94,12 +137,33 @@
buildActionMask = 2147483647;
files = (
CCDBFDE01E43366F005D6F08 /* HGCircularSlider.h in Headers */,
BB692D3D235E473800CB74DA /* CircularSlider.swift in Headers */,
BB692D3E235E473B00CB74DA /* MidPointCircularSlider.swift in Headers */,
BB692D3F235E474000CB74DA /* RangeCircularSlider.swift in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
BB692D2A235C9EB300CB74DA /* HGCircularSliderTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = BB692D35235C9EB300CB74DA /* Build configuration list for PBXNativeTarget "HGCircularSliderTests" */;
buildPhases = (
BB692D27235C9EB300CB74DA /* Sources */,
BB692D28235C9EB300CB74DA /* Frameworks */,
BB692D29235C9EB300CB74DA /* Resources */,
);
buildRules = (
);
dependencies = (
BB692D32235C9EB300CB74DA /* PBXTargetDependency */,
);
name = HGCircularSliderTests;
productName = HGCircularSliderTests;
productReference = BB692D2B235C9EB300CB74DA /* HGCircularSliderTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
CCDBFDDA1E43366F005D6F08 /* HGCircularSlider */ = {
isa = PBXNativeTarget;
buildConfigurationList = CCDBFDE31E43366F005D6F08 /* Build configuration list for PBXNativeTarget "HGCircularSlider" */;
@@ -124,9 +188,14 @@
CCDBFDD21E43366F005D6F08 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0820;
LastSwiftUpdateCheck = 1110;
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = intive;
TargetAttributes = {
BB692D2A235C9EB300CB74DA = {
CreatedOnToolsVersion = 11.1;
ProvisioningStyle = Automatic;
};
CCDBFDDA1E43366F005D6F08 = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = R6JBLAQ685;
@@ -136,10 +205,11 @@
};
buildConfigurationList = CCDBFDD51E43366F005D6F08 /* Build configuration list for PBXProject "HGCircularSlider" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = CCDBFDD11E43366F005D6F08;
productRefGroup = CCDBFDDC1E43366F005D6F08 /* Products */;
@@ -147,11 +217,19 @@
projectRoot = "";
targets = (
CCDBFDDA1E43366F005D6F08 /* HGCircularSlider */,
BB692D2A235C9EB300CB74DA /* HGCircularSliderTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
BB692D29235C9EB300CB74DA /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
CCDBFDD91E43366F005D6F08 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
@@ -163,6 +241,16 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
BB692D27235C9EB300CB74DA /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
BB692D2E235C9EB300CB74DA /* HGCircularSliderTests.swift in Sources */,
BB692D39235C9F1C00CB74DA /* CircularSliderTests.swift in Sources */,
BB692D37235C9F1100CB74DA /* CircularSliderHelperTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
CCDBFDD61E43366F005D6F08 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
@@ -177,25 +265,83 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
BB692D32235C9EB300CB74DA /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = CCDBFDDA1E43366F005D6F08 /* HGCircularSlider */;
targetProxy = BB692D31235C9EB300CB74DA /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
BB692D33235C9EB300CB74DA /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = HGCircularSliderTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.github.HGCircularSliderTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
BB692D34235C9EB300CB74DA /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = HGCircularSliderTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.1;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.github.HGCircularSliderTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
CCDBFDE11E43366F005D6F08 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -235,20 +381,29 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -293,7 +448,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intive.HGCircularSlider;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@@ -313,13 +468,22 @@
PRODUCT_BUNDLE_IDENTIFIER = com.intive.HGCircularSlider;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
BB692D35235C9EB300CB74DA /* Build configuration list for PBXNativeTarget "HGCircularSliderTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
BB692D33235C9EB300CB74DA /* Debug */,
BB692D34235C9EB300CB74DA /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
CCDBFDD51E43366F005D6F08 /* Build configuration list for PBXProject "HGCircularSlider" */ = {
isa = XCConfigurationList;
buildConfigurations = (
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
+11 -5
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -28,9 +28,17 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BB692D2A235C9EB300CB74DA"
BuildableName = "HGCircularSliderTests.xctest"
BlueprintName = "HGCircularSliderTests"
ReferencedContainer = "container:HGCircularSlider.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -51,8 +59,6 @@
ReferencedContainer = "container:HGCircularSlider.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
@@ -100,14 +100,21 @@ extension CircularSlider {
Draw the thumb and return the coordinates of its center
- parameter angle: the angle of the point in the main circle
- parameter image: the image of the thumb, if it's nil we use a disk (circle), the default value is nil
- parameter context: the context
- returns: return the origin point of the thumb
*/
@discardableResult
internal func drawThumb(withAngle angle: CGFloat, inContext context: CGContext) -> CGPoint {
let circle = Circle(origin: bounds.center, radius: self.radius)
internal func drawThumbAt(_ angle: CGFloat, with image: UIImage? = nil, inContext context: CGContext) -> CGPoint {
let circle = Circle(origin: bounds.center, radius: self.radius + self.thumbOffset)
let thumbOrigin = CircularSliderHelper.endPoint(fromCircle: circle, angle: angle)
if let image = image {
return drawThumb(withImage: image, thumbOrigin: thumbOrigin, inContext: context)
}
// Draw a disk as thumb
let thumbCircle = Circle(origin: thumbOrigin, radius: thumbRadius)
let thumbArc = Arc(circle: thumbCircle, startAngle: CircularSliderHelper.circleMinValue, endAngle: CircularSliderHelper.circleMaxValue)
@@ -125,11 +132,9 @@ extension CircularSlider {
- returns: return the origin point of the thumb
*/
@discardableResult
internal func drawThumb(withImage image: UIImage, angle: CGFloat, inContext context: CGContext) -> CGPoint {
private func drawThumb(withImage image: UIImage, thumbOrigin: CGPoint, inContext context: CGContext) -> CGPoint {
UIGraphicsPushContext(context)
context.beginPath()
let circle = Circle(origin: bounds.center, radius: self.radius)
let thumbOrigin = CircularSliderHelper.endPoint(fromCircle: circle, angle: angle)
let imageSize = image.size
let imageFrame = CGRect(x: thumbOrigin.x - (imageSize.width / 2), y: thumbOrigin.y - (imageSize.height / 2), width: imageSize.width, height: imageSize.height)
image.draw(in: imageFrame)
+40 -18
View File
@@ -171,7 +171,29 @@ open class CircularSlider: UIControl {
}
}
}
/**
* The offset of the thumb centre from the circle.
*
* You can use this to move the thumb inside or outside the circle of the slider
* If the value is grather than 0 the thumb will be displayed outside the cirlce
* And if the value is negative, the thumb will be displayed inside the circle
*/
@IBInspectable
open var thumbOffset: CGFloat = 0.0 {
didSet {
setNeedsDisplay()
}
}
/**
* Stop the thumb going beyond the min/max.
*
*/
@IBInspectable
open var stopThumbAtMinMax: Bool = false
/**
* The value of the endThumb (changed when the user change the position of the end thumb)
*
@@ -188,7 +210,7 @@ open class CircularSlider: UIControl {
if endPointValue > maximumValue {
endPointValue = maximumValue
}
else if endPointValue < minimumValue {
if endPointValue < minimumValue {
endPointValue = minimumValue
}
@@ -203,8 +225,12 @@ open class CircularSlider: UIControl {
get {
// the minimum between the height/2 and the width/2
var radius = min(bounds.center.x, bounds.center.y)
// if we use an image for the thumb, the radius of the image will be used
let maxThumbRadius = max(thumbRadius, (self.endThumbImage?.size.height ?? 0) / 2)
// all elements should be inside the view rect, for that we should subtract the highest value between the radius of thumb and the line width
radius -= max(lineWidth, (thumbRadius + thumbLineWidth))
radius -= max(lineWidth, (maxThumbRadius + thumbLineWidth + thumbOffset))
return radius
}
}
@@ -261,11 +287,7 @@ open class CircularSlider: UIControl {
endThumbTintColor.setFill()
(isHighlighted == true) ? endThumbStrokeHighlightedColor.setStroke() : endThumbStrokeColor.setStroke()
guard let image = endThumbImage else {
drawThumb(withAngle: endAngle, inContext: context)
return
}
drawThumb(withImage: image, angle: endAngle, inContext: context)
drawThumbAt(endAngle, with: endThumbImage, inContext: context)
}
// MARK: User interaction methods
@@ -307,18 +329,18 @@ open class CircularSlider: UIControl {
let interval = Interval(min: minimumValue, max: maximumValue, rounds: numberOfRounds)
let deltaValue = CircularSliderHelper.delta(in: interval, for: angle, oldValue: oldValue)
var newValue = oldValue + deltaValue
var newValue = oldValue + deltaValue - minimumValue
let range = maximumValue - minimumValue
if newValue > maximumValue {
newValue -= range
}
else if newValue < minimumValue {
newValue += range
if !stopThumbAtMinMax {
if newValue > maximumValue {
newValue -= range
}
else if newValue < minimumValue {
newValue += range
}
}
return newValue
}
}
@@ -13,7 +13,7 @@ internal struct Interval {
var min: CGFloat = 0.0
var max: CGFloat = 0.0
var rounds: Int
init(min: CGFloat, max: CGFloat, rounds: Int = 1) {
assert(min <= max && rounds > 0, NSLocalizedString("Illegal interval", comment: ""))
@@ -42,7 +42,7 @@ internal struct Arc {
var endAngle: CGFloat = 0.0
init(circle: Circle, startAngle: CGFloat, endAngle: CGFloat) {
self.circle = circle
self.startAngle = startAngle
self.endAngle = endAngle
@@ -87,9 +87,9 @@ internal extension CGVector {
}
internal extension CGRect {
// get the center of rect (bounds or frame)
internal var center: CGPoint {
var center: CGPoint {
get {
let center = CGPoint(x: midX, y: midY)
return center
@@ -114,7 +114,7 @@ internal class CircularSliderHelper {
internal static func degrees(fromRadians value: CGFloat) -> CGFloat {
return value * 180.0 / CGFloat(Double.pi)
}
/**
Returns the angle AÔB of an circle
@@ -176,12 +176,20 @@ internal class CircularSliderHelper {
- returns: the value in the new interval
*/
internal static func scaleValue(_ value: CGFloat, fromInterval source: Interval, toInterval destination: Interval) -> CGFloat {
let sourceRange = (source.max - source.min) / CGFloat(source.rounds)
let destinationRange = (destination.max - destination.min) / CGFloat(destination.rounds)
let scaledValue = source.min + (value - source.min).truncatingRemainder(dividingBy: sourceRange)
let newValue = (((scaledValue - source.min) * destinationRange) / sourceRange) + destination.min
return newValue
// If the value is equal to the min or the max no need to calculate
switch value {
case source.min:
return destination.min
case source.max:
return destination.max
default:
let sourceRange = (source.max - source.min) / CGFloat(source.rounds)
let destinationRange = (destination.max - destination.min) / CGFloat(destination.rounds)
let scaledValue = source.min + (value - source.min).truncatingRemainder(dividingBy: sourceRange)
let newValue = (((scaledValue - source.min) * destinationRange) / sourceRange) + destination.min
return newValue
}
}
/**
@@ -192,7 +200,7 @@ internal class CircularSliderHelper {
the angle value is equal to π
@see value(inInterval: fromAngle:)
- parameter aValue: the original value
- parameter oldIntreval: the original interval
@@ -223,16 +231,16 @@ internal class CircularSliderHelper {
return value
}
internal static func delta(in interval: Interval, for angle: CGFloat, oldValue: CGFloat) -> CGFloat {
let angleIntreval = Interval(min: circleMinValue , max: circleMaxValue)
let oldAngle = scaleToAngle(value: oldValue, inInterval: interval)
let deltaAngle = self.angle(from: oldAngle, to: angle)
return scaleValue(deltaAngle, fromInterval: angleIntreval, toInterval: interval)
}
/**
* Length (angular) of a shortest way between two angles.
* It will be in range [-π/2, π/2], where sign means dir (+ for clockwise, - for counter clockwise).
@@ -242,7 +250,7 @@ internal class CircularSliderHelper {
// Rotate right
let offset = alpha >= halfValue ? circleMaxValue - alpha : -alpha
let offsetBeta = beta + offset
if offsetBeta > halfValue {
return offsetBeta - circleMaxValue
}
@@ -117,11 +117,7 @@ open class MidPointCircularSlider: RangeCircularSlider {
midThumbTintColor.setFill()
(isHighlighted == true) ? midThumbStrokeHighlightedColor.setStroke() : midThumbStrokeColor.setStroke()
guard let image = midThumbImage else {
drawThumb(withAngle: midAngle, inContext: context)
return
}
drawThumb(withImage: image, angle: midAngle, inContext: context)
drawThumbAt(midAngle, with: midThumbImage, inContext: context)
}
// MARK: User interaction methods
@@ -235,19 +235,13 @@ open class RangeCircularSlider: CircularSlider {
// end thumb
endThumbTintColor.setFill()
(isHighlighted == true && selectedThumb == .endThumb) ? endThumbStrokeHighlightedColor.setStroke() : endThumbStrokeColor.setStroke()
endThumbCenter = drawThumb(withAngle: endAngle, inContext: context)
if let image = endThumbImage {
endThumbCenter = drawThumb(withImage: image, angle: endAngle, inContext: context)
}
endThumbCenter = drawThumbAt(endAngle, with: endThumbImage, inContext: context)
// start thumb
startThumbTintColor.setFill()
(isHighlighted == true && selectedThumb == .startThumb) ? startThumbStrokeHighlightedColor.setStroke() : startThumbStrokeColor.setStroke()
startThumbCenter = drawThumb(withAngle: startAngle, inContext: context)
if let image = startThumbImage {
startThumbCenter = drawThumb(withImage: image, angle: startAngle, inContext: context)
}
startThumbCenter = drawThumbAt(startAngle, with: startThumbImage, inContext: context)
}
// MARK: User interaction methods
@@ -0,0 +1,33 @@
//
// HGCircularSliderTests.swift
// HGCircularSliderTests
//
// Created by Hamza on 20/10/2019.
// Copyright © 2019 intive. All rights reserved.
//
import XCTest
class HGCircularSliderTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testExample() {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
func testPerformanceExample() {
// This is an example of a performance test case.
measure {
// Put the code you want to measure the time of here.
}
}
}
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
-30
View File
@@ -115,36 +115,6 @@ The project is Inspired by [UICircularSlider](https://github.com/Zedenem/UICircu
Hamza Ghazouani, hamza.ghazouani@gmail.com
## Contributors
This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
<a href="graphs/contributors"><img src="https://opencollective.com/HGCircularSlider/contributors.svg?width=890" /></a>
## Backers
Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/HGCircularSlider#backer)]
<a href="https://opencollective.com/HGCircularSlider#backers" target="_blank"><img src="https://opencollective.com/HGCircularSlider/backers.svg?width=890"></a>
## Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/HGCircularSlider#sponsor)]
<a href="https://opencollective.com/HGCircularSlider/sponsor/0/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/0/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/1/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/1/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/2/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/2/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/3/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/3/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/4/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/4/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/5/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/5/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/6/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/6/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/7/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/7/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/8/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/8/avatar.svg"></a>
<a href="https://opencollective.com/HGCircularSlider/sponsor/9/website" target="_blank"><img src="https://opencollective.com/HGCircularSlider/sponsor/9/avatar.svg"></a>
## License
HGCircularSlider is available under the MIT license. See the LICENSE file for more info.