Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d38b82c204 | |||
| 433de29f6e | |||
| 892d1002a5 | |||
| a19a4fcf6c | |||
| 93fb96cf68 | |||
| 5ae6977456 | |||
| 1cf18763eb | |||
| 6512f79197 |
@@ -0,0 +1 @@
|
||||
ko_fi: hamzaghazouani
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
language: objective-c
|
||||
os: osx
|
||||
osx_image:
|
||||
- xcode10.1
|
||||
- xcode10.2
|
||||
|
||||
env:
|
||||
global:
|
||||
|
||||
@@ -227,14 +227,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 +242,7 @@
|
||||
};
|
||||
buildConfigurationList = 607FACCB1AFB9204008FA782 /* Build configuration list for PBXProject "HGCircularSlider" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
@@ -305,7 +305,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 +314,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 */ = {
|
||||
@@ -435,7 +435,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 +482,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 +496,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 +519,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 +541,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 +551,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 +561,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
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -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
@@ -1,5 +1,5 @@
|
||||
use_frameworks!
|
||||
platform :ios, '9.0'
|
||||
platform :ios, '12.0'
|
||||
|
||||
target 'HGCircularSlider_Example' do
|
||||
pod 'HGCircularSlider', :path => '../'
|
||||
|
||||
@@ -9,8 +9,8 @@ EXTERNAL SOURCES:
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
HGCircularSlider: efaff4ec1b6eae905519440775e5088f4a0455ef
|
||||
HGCircularSlider: 76cd7ce7b7865d93210bd9e45f53dcab6917f9ad
|
||||
|
||||
PODFILE CHECKSUM: ea58587f670c5d07b17de771dcc7a8944f82a3aa
|
||||
PODFILE CHECKSUM: 5935efe45bed5ee625cec9162a170ce99849ca5c
|
||||
|
||||
COCOAPODS: 1.5.3
|
||||
COCOAPODS: 1.7.4
|
||||
|
||||
+3
-1
@@ -2,6 +2,7 @@
|
||||
"name": "HGCircularSlider",
|
||||
"version": "2.1.0",
|
||||
"summary": "Multiple Circular Sliders used to select a value from a continuous range of values.",
|
||||
"swift_versions": "4.2",
|
||||
"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": {
|
||||
@@ -19,5 +20,6 @@
|
||||
"platforms": {
|
||||
"ios": "8.0"
|
||||
},
|
||||
"source_files": "HGCircularSlider/Classes/**/*"
|
||||
"source_files": "HGCircularSlider/Classes/**/*",
|
||||
"swift_version": "4.2"
|
||||
}
|
||||
|
||||
Generated
+3
-3
@@ -9,8 +9,8 @@ EXTERNAL SOURCES:
|
||||
:path: "../"
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
HGCircularSlider: efaff4ec1b6eae905519440775e5088f4a0455ef
|
||||
HGCircularSlider: 76cd7ce7b7865d93210bd9e45f53dcab6917f9ad
|
||||
|
||||
PODFILE CHECKSUM: ea58587f670c5d07b17de771dcc7a8944f82a3aa
|
||||
PODFILE CHECKSUM: 5935efe45bed5ee625cec9162a170ce99849ca5c
|
||||
|
||||
COCOAPODS: 1.5.3
|
||||
COCOAPODS: 1.7.4
|
||||
|
||||
+397
-401
File diff suppressed because it is too large
Load Diff
+26
@@ -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.1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${CURRENT_PROJECT_VERSION}</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
+1
-1
@@ -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}
|
||||
|
||||
+26
@@ -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>
|
||||
+28
-10
@@ -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
|
||||
|
||||
+2
-2
@@ -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}/.
|
||||
|
||||
+2
-2
@@ -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}/.
|
||||
|
||||
Example/Pods/Target Support Files/Pods-HGCircularSlider_Tests/Pods-HGCircularSlider_Tests-Info.plist
Generated
+26
@@ -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>
|
||||
+2
-2
@@ -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}/.
|
||||
|
||||
+2
-2
@@ -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,50 @@
|
||||
//
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
@@ -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.
|
||||
|
||||
Regular → Executable
+23
-4
@@ -124,7 +124,7 @@
|
||||
CCDBFDD21E43366F005D6F08 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0820;
|
||||
LastUpgradeCheck = 1020;
|
||||
ORGANIZATIONNAME = intive;
|
||||
TargetAttributes = {
|
||||
CCDBFDDA1E43366F005D6F08 = {
|
||||
@@ -136,10 +136,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 */;
|
||||
@@ -182,20 +183,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;
|
||||
@@ -235,20 +245,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 +312,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,7 +332,7 @@
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.intive.HGCircularSlider;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_VERSION = 3.0;
|
||||
SWIFT_VERSION = 5.0;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
Generated
Regular → Executable
@@ -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>
|
||||
Regular → Executable
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0820"
|
||||
LastUpgradeVersion = "1020"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
*
|
||||
@@ -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
|
||||
@@ -309,13 +331,16 @@ open class CircularSlider: UIControl {
|
||||
|
||||
var newValue = oldValue + deltaValue
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user