├── .gitignore ├── AMColorPicker.podspec ├── AMColorPicker.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ └── AMColorPicker.xcscheme ├── AMColorPicker ├── AMColorPicker.h └── Info.plist ├── LICENSE ├── README.md ├── SampleAMColorPicker ├── SampleAMColorPicker.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── SampleAMColorPicker │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon1024.png │ │ ├── icon20.png │ │ ├── icon20@2x-1.png │ │ ├── icon20@2x.png │ │ ├── icon20@3x.png │ │ ├── icon29.png │ │ ├── icon29@2x-1.png │ │ ├── icon29@2x.png │ │ ├── icon29@3x.png │ │ ├── icon40.png │ │ ├── icon40@2x-1.png │ │ ├── icon40@2x.png │ │ ├── icon40@3x.png │ │ ├── icon60@2x.png │ │ ├── icon60@3x.png │ │ ├── icon76.png │ │ ├── icon76@2x.png │ │ └── icon835@2x.png │ ├── Contents.json │ └── logo_typeA.imageset │ │ ├── Contents.json │ │ └── logotype-a.png │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Classes │ ├── AppDelegate.swift │ └── ViewController.swift │ └── Info.plist ├── Source ├── AMColorPickerAssets.xcassets │ ├── Contents.json │ └── textColor.colorset │ │ └── Contents.json ├── AMColorPickerProtocol.swift ├── AMColorPickerViewController.swift ├── AMColorPickerViewController.xib ├── image │ ├── AMCP_color_wheel@2x.png │ ├── AMCP_cursor@2x.png │ └── AMCP_slider_thumb@2x.png └── view │ ├── AMColorPickerRGBSliderView.swift │ ├── AMColorPickerRGBSliderView.xib │ ├── AMColorPickerTableView.swift │ ├── AMColorPickerTableView.xib │ ├── AMColorPickerWheelView.swift │ ├── AMColorPickerWheelView.xib │ ├── Cell │ ├── AMColorPickerTableViewCell.swift │ └── AMColorPickerTableViewCell.xib │ └── Slider │ └── AMColorPickerSlider.swift └── logo ├── favicon-01.png ├── favicon.svg ├── logotype-a.png ├── logotype-a.svg ├── logotype-b.png └── logotype-b.svg /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode (from gitignore.io) 2 | build/ 3 | *.pbxuser 4 | !default.pbxuser 5 | *.mode1v3 6 | !default.mode1v3 7 | *.mode2v3 8 | !default.mode2v3 9 | *.perspectivev3 10 | !default.perspectivev3 11 | xcuserdata 12 | *.xccheckout 13 | *.moved-aside 14 | DerivedData 15 | *.hmap 16 | *.ipa 17 | *.xcuserstate 18 | 19 | # CocoaPod 20 | Pods/* 21 | Podfile.lock 22 | 23 | # Carthage 24 | Carthage/Build 25 | 26 | # others 27 | *.swp 28 | !.gitkeep 29 | .DS_Store 30 | UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /AMColorPicker.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "AMColorPicker" 3 | s.version = "3.0.1" 4 | s.summary = "AMColorPicker can select color by three ways." 5 | s.license = { :type => 'MIT', :file => 'LICENSE' } 6 | s.homepage = "https://github.com/adventam10/AMColorPicker" 7 | s.author = { "am10" => "adventam10@gmail.com" } 8 | s.source = { :git => "https://github.com/adventam10/AMColorPicker.git", :tag => "#{s.version}" } 9 | s.platform = :ios, "11.0" 10 | s.requires_arc = true 11 | s.source_files = 'Source/**/*.{swift}' 12 | s.resources = 'Source/**/*.{xib,png,xcassets}' 13 | s.swift_version = "5.0" 14 | end 15 | -------------------------------------------------------------------------------- /AMColorPicker.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0E407AB823547E990096FA4A /* AMColorPickerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AA423547E990096FA4A /* AMColorPickerViewController.xib */; }; 11 | 0E407AB923547E990096FA4A /* AMColorPickerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AA523547E990096FA4A /* AMColorPickerProtocol.swift */; }; 12 | 0E407ABA23547E990096FA4A /* AMColorPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AA623547E990096FA4A /* AMColorPickerViewController.swift */; }; 13 | 0E407ABB23547E990096FA4A /* AMCP_cursor@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AA823547E990096FA4A /* AMCP_cursor@2x.png */; }; 14 | 0E407ABC23547E990096FA4A /* AMCP_slider_thumb@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AA923547E990096FA4A /* AMCP_slider_thumb@2x.png */; }; 15 | 0E407ABD23547E990096FA4A /* AMCP_color_wheel@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AAA23547E990096FA4A /* AMCP_color_wheel@2x.png */; }; 16 | 0E407ABE23547E990096FA4A /* AMColorPickerAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AAB23547E990096FA4A /* AMColorPickerAssets.xcassets */; }; 17 | 0E407ABF23547E990096FA4A /* AMColorPickerWheelView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AAD23547E990096FA4A /* AMColorPickerWheelView.xib */; }; 18 | 0E407AC023547E990096FA4A /* AMColorPickerWheelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AAE23547E990096FA4A /* AMColorPickerWheelView.swift */; }; 19 | 0E407AC123547E990096FA4A /* AMColorPickerTableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AAF23547E990096FA4A /* AMColorPickerTableView.xib */; }; 20 | 0E407AC223547E990096FA4A /* AMColorPickerTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AB023547E990096FA4A /* AMColorPickerTableView.swift */; }; 21 | 0E407AC323547E990096FA4A /* AMColorPickerSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AB223547E990096FA4A /* AMColorPickerSlider.swift */; }; 22 | 0E407AC423547E990096FA4A /* AMColorPickerTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AB423547E990096FA4A /* AMColorPickerTableViewCell.xib */; }; 23 | 0E407AC523547E990096FA4A /* AMColorPickerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AB523547E990096FA4A /* AMColorPickerTableViewCell.swift */; }; 24 | 0E407AC623547E990096FA4A /* AMColorPickerRGBSliderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AB623547E990096FA4A /* AMColorPickerRGBSliderView.xib */; }; 25 | 0E407AC723547E990096FA4A /* AMColorPickerRGBSliderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AB723547E990096FA4A /* AMColorPickerRGBSliderView.swift */; }; 26 | 0E4753EC201F77B1002EA382 /* AMColorPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 0E4753EA201F77B1002EA382 /* AMColorPicker.h */; settings = {ATTRIBUTES = (Public, ); }; }; 27 | /* End PBXBuildFile section */ 28 | 29 | /* Begin PBXFileReference section */ 30 | 0E407AA423547E990096FA4A /* AMColorPickerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerViewController.xib; sourceTree = ""; }; 31 | 0E407AA523547E990096FA4A /* AMColorPickerProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerProtocol.swift; sourceTree = ""; }; 32 | 0E407AA623547E990096FA4A /* AMColorPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerViewController.swift; sourceTree = ""; }; 33 | 0E407AA823547E990096FA4A /* AMCP_cursor@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AMCP_cursor@2x.png"; sourceTree = ""; }; 34 | 0E407AA923547E990096FA4A /* AMCP_slider_thumb@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AMCP_slider_thumb@2x.png"; sourceTree = ""; }; 35 | 0E407AAA23547E990096FA4A /* AMCP_color_wheel@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AMCP_color_wheel@2x.png"; sourceTree = ""; }; 36 | 0E407AAB23547E990096FA4A /* AMColorPickerAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = AMColorPickerAssets.xcassets; sourceTree = ""; }; 37 | 0E407AAD23547E990096FA4A /* AMColorPickerWheelView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerWheelView.xib; sourceTree = ""; }; 38 | 0E407AAE23547E990096FA4A /* AMColorPickerWheelView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerWheelView.swift; sourceTree = ""; }; 39 | 0E407AAF23547E990096FA4A /* AMColorPickerTableView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerTableView.xib; sourceTree = ""; }; 40 | 0E407AB023547E990096FA4A /* AMColorPickerTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerTableView.swift; sourceTree = ""; }; 41 | 0E407AB223547E990096FA4A /* AMColorPickerSlider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerSlider.swift; sourceTree = ""; }; 42 | 0E407AB423547E990096FA4A /* AMColorPickerTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerTableViewCell.xib; sourceTree = ""; }; 43 | 0E407AB523547E990096FA4A /* AMColorPickerTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerTableViewCell.swift; sourceTree = ""; }; 44 | 0E407AB623547E990096FA4A /* AMColorPickerRGBSliderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerRGBSliderView.xib; sourceTree = ""; }; 45 | 0E407AB723547E990096FA4A /* AMColorPickerRGBSliderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerRGBSliderView.swift; sourceTree = ""; }; 46 | 0E4753E7201F77B1002EA382 /* AMColorPicker.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AMColorPicker.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 47 | 0E4753EA201F77B1002EA382 /* AMColorPicker.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AMColorPicker.h; sourceTree = ""; }; 48 | 0E4753EB201F77B1002EA382 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | /* End PBXFileReference section */ 50 | 51 | /* Begin PBXFrameworksBuildPhase section */ 52 | 0E4753E3201F77B1002EA382 /* Frameworks */ = { 53 | isa = PBXFrameworksBuildPhase; 54 | buildActionMask = 2147483647; 55 | files = ( 56 | ); 57 | runOnlyForDeploymentPostprocessing = 0; 58 | }; 59 | /* End PBXFrameworksBuildPhase section */ 60 | 61 | /* Begin PBXGroup section */ 62 | 0E407AA323547E990096FA4A /* Source */ = { 63 | isa = PBXGroup; 64 | children = ( 65 | 0E407AA423547E990096FA4A /* AMColorPickerViewController.xib */, 66 | 0E407AA523547E990096FA4A /* AMColorPickerProtocol.swift */, 67 | 0E407AA623547E990096FA4A /* AMColorPickerViewController.swift */, 68 | 0E407AA723547E990096FA4A /* image */, 69 | 0E407AAB23547E990096FA4A /* AMColorPickerAssets.xcassets */, 70 | 0E407AAC23547E990096FA4A /* view */, 71 | ); 72 | path = Source; 73 | sourceTree = ""; 74 | }; 75 | 0E407AA723547E990096FA4A /* image */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 0E407AA823547E990096FA4A /* AMCP_cursor@2x.png */, 79 | 0E407AA923547E990096FA4A /* AMCP_slider_thumb@2x.png */, 80 | 0E407AAA23547E990096FA4A /* AMCP_color_wheel@2x.png */, 81 | ); 82 | path = image; 83 | sourceTree = ""; 84 | }; 85 | 0E407AAC23547E990096FA4A /* view */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | 0E407AAD23547E990096FA4A /* AMColorPickerWheelView.xib */, 89 | 0E407AAE23547E990096FA4A /* AMColorPickerWheelView.swift */, 90 | 0E407AAF23547E990096FA4A /* AMColorPickerTableView.xib */, 91 | 0E407AB023547E990096FA4A /* AMColorPickerTableView.swift */, 92 | 0E407AB123547E990096FA4A /* Slider */, 93 | 0E407AB323547E990096FA4A /* Cell */, 94 | 0E407AB623547E990096FA4A /* AMColorPickerRGBSliderView.xib */, 95 | 0E407AB723547E990096FA4A /* AMColorPickerRGBSliderView.swift */, 96 | ); 97 | path = view; 98 | sourceTree = ""; 99 | }; 100 | 0E407AB123547E990096FA4A /* Slider */ = { 101 | isa = PBXGroup; 102 | children = ( 103 | 0E407AB223547E990096FA4A /* AMColorPickerSlider.swift */, 104 | ); 105 | path = Slider; 106 | sourceTree = ""; 107 | }; 108 | 0E407AB323547E990096FA4A /* Cell */ = { 109 | isa = PBXGroup; 110 | children = ( 111 | 0E407AB423547E990096FA4A /* AMColorPickerTableViewCell.xib */, 112 | 0E407AB523547E990096FA4A /* AMColorPickerTableViewCell.swift */, 113 | ); 114 | path = Cell; 115 | sourceTree = ""; 116 | }; 117 | 0E4753DD201F77B1002EA382 = { 118 | isa = PBXGroup; 119 | children = ( 120 | 0E407AA323547E990096FA4A /* Source */, 121 | 0E4753E9201F77B1002EA382 /* AMColorPicker */, 122 | 0E4753E8201F77B1002EA382 /* Products */, 123 | ); 124 | sourceTree = ""; 125 | }; 126 | 0E4753E8201F77B1002EA382 /* Products */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 0E4753E7201F77B1002EA382 /* AMColorPicker.framework */, 130 | ); 131 | name = Products; 132 | sourceTree = ""; 133 | }; 134 | 0E4753E9201F77B1002EA382 /* AMColorPicker */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 0E4753EA201F77B1002EA382 /* AMColorPicker.h */, 138 | 0E4753EB201F77B1002EA382 /* Info.plist */, 139 | ); 140 | path = AMColorPicker; 141 | sourceTree = ""; 142 | }; 143 | /* End PBXGroup section */ 144 | 145 | /* Begin PBXHeadersBuildPhase section */ 146 | 0E4753E4201F77B1002EA382 /* Headers */ = { 147 | isa = PBXHeadersBuildPhase; 148 | buildActionMask = 2147483647; 149 | files = ( 150 | 0E4753EC201F77B1002EA382 /* AMColorPicker.h in Headers */, 151 | ); 152 | runOnlyForDeploymentPostprocessing = 0; 153 | }; 154 | /* End PBXHeadersBuildPhase section */ 155 | 156 | /* Begin PBXNativeTarget section */ 157 | 0E4753E6201F77B1002EA382 /* AMColorPicker */ = { 158 | isa = PBXNativeTarget; 159 | buildConfigurationList = 0E4753EF201F77B1002EA382 /* Build configuration list for PBXNativeTarget "AMColorPicker" */; 160 | buildPhases = ( 161 | 0E4753E2201F77B1002EA382 /* Sources */, 162 | 0E4753E3201F77B1002EA382 /* Frameworks */, 163 | 0E4753E4201F77B1002EA382 /* Headers */, 164 | 0E4753E5201F77B1002EA382 /* Resources */, 165 | ); 166 | buildRules = ( 167 | ); 168 | dependencies = ( 169 | ); 170 | name = AMColorPicker; 171 | productName = AMColorPicker; 172 | productReference = 0E4753E7201F77B1002EA382 /* AMColorPicker.framework */; 173 | productType = "com.apple.product-type.framework"; 174 | }; 175 | /* End PBXNativeTarget section */ 176 | 177 | /* Begin PBXProject section */ 178 | 0E4753DE201F77B1002EA382 /* Project object */ = { 179 | isa = PBXProject; 180 | attributes = { 181 | LastUpgradeCheck = 1020; 182 | ORGANIZATIONNAME = am10; 183 | TargetAttributes = { 184 | 0E4753E6201F77B1002EA382 = { 185 | CreatedOnToolsVersion = 9.2; 186 | LastSwiftMigration = 1020; 187 | ProvisioningStyle = Automatic; 188 | }; 189 | }; 190 | }; 191 | buildConfigurationList = 0E4753E1201F77B1002EA382 /* Build configuration list for PBXProject "AMColorPicker" */; 192 | compatibilityVersion = "Xcode 8.0"; 193 | developmentRegion = en; 194 | hasScannedForEncodings = 0; 195 | knownRegions = ( 196 | en, 197 | Base, 198 | ); 199 | mainGroup = 0E4753DD201F77B1002EA382; 200 | productRefGroup = 0E4753E8201F77B1002EA382 /* Products */; 201 | projectDirPath = ""; 202 | projectRoot = ""; 203 | targets = ( 204 | 0E4753E6201F77B1002EA382 /* AMColorPicker */, 205 | ); 206 | }; 207 | /* End PBXProject section */ 208 | 209 | /* Begin PBXResourcesBuildPhase section */ 210 | 0E4753E5201F77B1002EA382 /* Resources */ = { 211 | isa = PBXResourcesBuildPhase; 212 | buildActionMask = 2147483647; 213 | files = ( 214 | 0E407ABF23547E990096FA4A /* AMColorPickerWheelView.xib in Resources */, 215 | 0E407ABC23547E990096FA4A /* AMCP_slider_thumb@2x.png in Resources */, 216 | 0E407AC623547E990096FA4A /* AMColorPickerRGBSliderView.xib in Resources */, 217 | 0E407AC123547E990096FA4A /* AMColorPickerTableView.xib in Resources */, 218 | 0E407AB823547E990096FA4A /* AMColorPickerViewController.xib in Resources */, 219 | 0E407ABB23547E990096FA4A /* AMCP_cursor@2x.png in Resources */, 220 | 0E407AC423547E990096FA4A /* AMColorPickerTableViewCell.xib in Resources */, 221 | 0E407ABD23547E990096FA4A /* AMCP_color_wheel@2x.png in Resources */, 222 | 0E407ABE23547E990096FA4A /* AMColorPickerAssets.xcassets in Resources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXResourcesBuildPhase section */ 227 | 228 | /* Begin PBXSourcesBuildPhase section */ 229 | 0E4753E2201F77B1002EA382 /* Sources */ = { 230 | isa = PBXSourcesBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | 0E407AC323547E990096FA4A /* AMColorPickerSlider.swift in Sources */, 234 | 0E407ABA23547E990096FA4A /* AMColorPickerViewController.swift in Sources */, 235 | 0E407AC223547E990096FA4A /* AMColorPickerTableView.swift in Sources */, 236 | 0E407AC023547E990096FA4A /* AMColorPickerWheelView.swift in Sources */, 237 | 0E407AC523547E990096FA4A /* AMColorPickerTableViewCell.swift in Sources */, 238 | 0E407AB923547E990096FA4A /* AMColorPickerProtocol.swift in Sources */, 239 | 0E407AC723547E990096FA4A /* AMColorPickerRGBSliderView.swift in Sources */, 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | /* End PBXSourcesBuildPhase section */ 244 | 245 | /* Begin XCBuildConfiguration section */ 246 | 0E4753ED201F77B1002EA382 /* Debug */ = { 247 | isa = XCBuildConfiguration; 248 | buildSettings = { 249 | ALWAYS_SEARCH_USER_PATHS = NO; 250 | CLANG_ANALYZER_NONNULL = YES; 251 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 252 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 253 | CLANG_CXX_LIBRARY = "libc++"; 254 | CLANG_ENABLE_MODULES = YES; 255 | CLANG_ENABLE_OBJC_ARC = YES; 256 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 257 | CLANG_WARN_BOOL_CONVERSION = YES; 258 | CLANG_WARN_COMMA = YES; 259 | CLANG_WARN_CONSTANT_CONVERSION = YES; 260 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 261 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 262 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 263 | CLANG_WARN_EMPTY_BODY = YES; 264 | CLANG_WARN_ENUM_CONVERSION = YES; 265 | CLANG_WARN_INFINITE_RECURSION = YES; 266 | CLANG_WARN_INT_CONVERSION = YES; 267 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 268 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 269 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 270 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 271 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 272 | CLANG_WARN_STRICT_PROTOTYPES = YES; 273 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 274 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 275 | CLANG_WARN_UNREACHABLE_CODE = YES; 276 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 277 | CODE_SIGN_IDENTITY = "iPhone Developer"; 278 | COPY_PHASE_STRIP = NO; 279 | CURRENT_PROJECT_VERSION = 1; 280 | DEBUG_INFORMATION_FORMAT = dwarf; 281 | ENABLE_STRICT_OBJC_MSGSEND = YES; 282 | ENABLE_TESTABILITY = YES; 283 | GCC_C_LANGUAGE_STANDARD = gnu11; 284 | GCC_DYNAMIC_NO_PIC = NO; 285 | GCC_NO_COMMON_BLOCKS = YES; 286 | GCC_OPTIMIZATION_LEVEL = 0; 287 | GCC_PREPROCESSOR_DEFINITIONS = ( 288 | "DEBUG=1", 289 | "$(inherited)", 290 | ); 291 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 292 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 293 | GCC_WARN_UNDECLARED_SELECTOR = YES; 294 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 295 | GCC_WARN_UNUSED_FUNCTION = YES; 296 | GCC_WARN_UNUSED_VARIABLE = YES; 297 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 298 | MTL_ENABLE_DEBUG_INFO = YES; 299 | ONLY_ACTIVE_ARCH = YES; 300 | SDKROOT = iphoneos; 301 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 302 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 303 | VERSIONING_SYSTEM = "apple-generic"; 304 | VERSION_INFO_PREFIX = ""; 305 | }; 306 | name = Debug; 307 | }; 308 | 0E4753EE201F77B1002EA382 /* Release */ = { 309 | isa = XCBuildConfiguration; 310 | buildSettings = { 311 | ALWAYS_SEARCH_USER_PATHS = NO; 312 | CLANG_ANALYZER_NONNULL = YES; 313 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 314 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 315 | CLANG_CXX_LIBRARY = "libc++"; 316 | CLANG_ENABLE_MODULES = YES; 317 | CLANG_ENABLE_OBJC_ARC = YES; 318 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 319 | CLANG_WARN_BOOL_CONVERSION = YES; 320 | CLANG_WARN_COMMA = YES; 321 | CLANG_WARN_CONSTANT_CONVERSION = YES; 322 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 323 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 324 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 325 | CLANG_WARN_EMPTY_BODY = YES; 326 | CLANG_WARN_ENUM_CONVERSION = YES; 327 | CLANG_WARN_INFINITE_RECURSION = YES; 328 | CLANG_WARN_INT_CONVERSION = YES; 329 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 330 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 331 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 333 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 334 | CLANG_WARN_STRICT_PROTOTYPES = YES; 335 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 336 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 337 | CLANG_WARN_UNREACHABLE_CODE = YES; 338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 339 | CODE_SIGN_IDENTITY = "iPhone Developer"; 340 | COPY_PHASE_STRIP = NO; 341 | CURRENT_PROJECT_VERSION = 1; 342 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 343 | ENABLE_NS_ASSERTIONS = NO; 344 | ENABLE_STRICT_OBJC_MSGSEND = YES; 345 | GCC_C_LANGUAGE_STANDARD = gnu11; 346 | GCC_NO_COMMON_BLOCKS = YES; 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNDECLARED_SELECTOR = YES; 350 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 351 | GCC_WARN_UNUSED_FUNCTION = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 354 | MTL_ENABLE_DEBUG_INFO = NO; 355 | SDKROOT = iphoneos; 356 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 357 | VALIDATE_PRODUCT = YES; 358 | VERSIONING_SYSTEM = "apple-generic"; 359 | VERSION_INFO_PREFIX = ""; 360 | }; 361 | name = Release; 362 | }; 363 | 0E4753F0201F77B1002EA382 /* Debug */ = { 364 | isa = XCBuildConfiguration; 365 | buildSettings = { 366 | CODE_SIGN_IDENTITY = ""; 367 | CODE_SIGN_STYLE = Automatic; 368 | DEFINES_MODULE = YES; 369 | DEVELOPMENT_TEAM = ""; 370 | DYLIB_COMPATIBILITY_VERSION = 1; 371 | DYLIB_CURRENT_VERSION = 1; 372 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 373 | INFOPLIST_FILE = AMColorPicker/Info.plist; 374 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 375 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 376 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 377 | PRODUCT_BUNDLE_IDENTIFIER = am10.AMColorPicker; 378 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 379 | SKIP_INSTALL = YES; 380 | SWIFT_VERSION = 5.0; 381 | TARGETED_DEVICE_FAMILY = "1,2"; 382 | }; 383 | name = Debug; 384 | }; 385 | 0E4753F1201F77B1002EA382 /* Release */ = { 386 | isa = XCBuildConfiguration; 387 | buildSettings = { 388 | CODE_SIGN_IDENTITY = ""; 389 | CODE_SIGN_STYLE = Automatic; 390 | DEFINES_MODULE = YES; 391 | DEVELOPMENT_TEAM = ""; 392 | DYLIB_COMPATIBILITY_VERSION = 1; 393 | DYLIB_CURRENT_VERSION = 1; 394 | DYLIB_INSTALL_NAME_BASE = "@rpath"; 395 | INFOPLIST_FILE = AMColorPicker/Info.plist; 396 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; 397 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 398 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 399 | PRODUCT_BUNDLE_IDENTIFIER = am10.AMColorPicker; 400 | PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; 401 | SKIP_INSTALL = YES; 402 | SWIFT_VERSION = 5.0; 403 | TARGETED_DEVICE_FAMILY = "1,2"; 404 | }; 405 | name = Release; 406 | }; 407 | /* End XCBuildConfiguration section */ 408 | 409 | /* Begin XCConfigurationList section */ 410 | 0E4753E1201F77B1002EA382 /* Build configuration list for PBXProject "AMColorPicker" */ = { 411 | isa = XCConfigurationList; 412 | buildConfigurations = ( 413 | 0E4753ED201F77B1002EA382 /* Debug */, 414 | 0E4753EE201F77B1002EA382 /* Release */, 415 | ); 416 | defaultConfigurationIsVisible = 0; 417 | defaultConfigurationName = Release; 418 | }; 419 | 0E4753EF201F77B1002EA382 /* Build configuration list for PBXNativeTarget "AMColorPicker" */ = { 420 | isa = XCConfigurationList; 421 | buildConfigurations = ( 422 | 0E4753F0201F77B1002EA382 /* Debug */, 423 | 0E4753F1201F77B1002EA382 /* Release */, 424 | ); 425 | defaultConfigurationIsVisible = 0; 426 | defaultConfigurationName = Release; 427 | }; 428 | /* End XCConfigurationList section */ 429 | }; 430 | rootObject = 0E4753DE201F77B1002EA382 /* Project object */; 431 | } 432 | -------------------------------------------------------------------------------- /AMColorPicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AMColorPicker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AMColorPicker.xcodeproj/xcshareddata/xcschemes/AMColorPicker.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /AMColorPicker/AMColorPicker.h: -------------------------------------------------------------------------------- 1 | // 2 | // AMColorPicker.h 3 | // AMColorPicker 4 | // 5 | // Created by am10 on 2018/01/30. 6 | // Copyright © 2018年 am10. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for AMColorPicker. 12 | FOUNDATION_EXPORT double AMColorPickerVersionNumber; 13 | 14 | //! Project version string for AMColorPicker. 15 | FOUNDATION_EXPORT const unsigned char AMColorPickerVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /AMColorPicker/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSPrincipalClass 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 adventam10 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![AMColorPicker](https://github.com/Tobaloidee/AMColorPicker/blob/master/logo/logotype-a.png) 2 | 3 | ![Pod Platform](https://img.shields.io/cocoapods/p/AMColorPicker.svg?style=flat) 4 | ![Pod License](https://img.shields.io/cocoapods/l/AMColorPicker.svg?style=flat) 5 | [![Pod Version](https://img.shields.io/cocoapods/v/AMColorPicker.svg?style=flat)](http://cocoapods.org/pods/AMColorPicker) 6 | [![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 7 | 8 | `AMColorPicker` can select color by three ways. 9 | 10 | ## Demo 11 | 12 | ![colorpicker](https://user-images.githubusercontent.com/34936885/34912854-08240a12-f92f-11e7-8f1a-f1589ca8f8ec.gif) 13 | 14 | | Wheel | Table | Slider | 15 | | ---- | ---- | ---- | 16 | | ![wheel](https://user-images.githubusercontent.com/34936885/35519518-d76bd3ca-0557-11e8-87f6-8f3c380b1583.png) | ![table](https://user-images.githubusercontent.com/34936885/35519545-eb43810e-0557-11e8-83a6-420cb32fe54a.png) | ![slider](https://user-images.githubusercontent.com/34936885/35519569-f804158e-0557-11e8-95ea-05318a72db47.png) | 17 | 18 | ## Usage 19 | 20 | Adopt the AMColorPickerDelegate protocol in the class declaration. 21 | 22 | ```swift 23 | class ViewController: UIViewController, AMColorPickerDelegate 24 | ``` 25 | 26 | Conform to the protocol in the class implementation. 27 | 28 | ```swift 29 | func colorPicker(_ colorPicker: AMColorPicker, didSelect color: UIColor) { 30 | // use selected color here 31 | } 32 | ``` 33 | 34 | Create and present the AMColorPicker as you see fit. 35 | 36 | ```swift 37 | let colorPickerViewController = AMColorPickerViewController() 38 | colorPickerViewController.selectedColor = .red 39 | colorPickerViewController.delegate = self 40 | present(colorPickerViewController, animated: true, completion: nil) 41 | ``` 42 | 43 | ### Customization 44 | `AMColorPicker` can be customized via the following properties. 45 | 46 | ```swift 47 | public var selectedColor: UIColor = .white 48 | public var isCloseButtonShown: Bool = true 49 | public var isSelectedColorShown: Bool = true 50 | ``` 51 | 52 | #### Modal 53 | | Wheel | Table | Slider | 54 | | ---- | ---- | ---- | 55 | | ![modal_w](https://user-images.githubusercontent.com/34936885/66719031-9b681100-ee25-11e9-9c3b-e9b15b5519e6.png) | ![modal_t](https://user-images.githubusercontent.com/34936885/66719024-9014e580-ee25-11e9-9973-1dac2b90251d.png) | ![modal_s](https://user-images.githubusercontent.com/34936885/66719021-825f6000-ee25-11e9-8ebb-dc85a0dc26a9.png) | 56 | 57 | #### Push 58 | | Wheel | Table | Slider | 59 | | ---- | ---- | ---- | 60 | | ![push_w](https://user-images.githubusercontent.com/34936885/66719044-b63a8580-ee25-11e9-97ef-dbe1aa543378.png) | ![push_t](https://user-images.githubusercontent.com/34936885/66719039-ab7ff080-ee25-11e9-9d0c-941c2c42a478.png) | ![push_s](https://user-images.githubusercontent.com/34936885/66719035-a327b580-ee25-11e9-80cc-53d01172e792.png) | 61 | 62 | #### Popover 63 | Min height is 380. 64 | 65 | | Wheel | Table | Slider | 66 | | ---- | ---- | ---- | 67 | | ![pop_w](https://user-images.githubusercontent.com/34936885/66719052-cf433680-ee25-11e9-9ae8-6c376df192ba.png) | ![pop_t](https://user-images.githubusercontent.com/34936885/66719051-c81c2880-ee25-11e9-9230-6d90125fd096.png) | ![pop_s](https://user-images.githubusercontent.com/34936885/66719046-bfc3ed80-ee25-11e9-9861-d52fa66dbeb8.png) | 68 | 69 | #### Dark Mode 70 | | Wheel | Table | Slider | 71 | | ---- | ---- | ---- | 72 | | ![dark_w](https://user-images.githubusercontent.com/34936885/66719020-74a9da80-ee25-11e9-9403-056694fe1ab0.png) | ![dark_t](https://user-images.githubusercontent.com/34936885/66719018-6d82cc80-ee25-11e9-8404-3ed4581b326c.png) | ![dark_s](https://user-images.githubusercontent.com/34936885/66719011-5cd25680-ee25-11e9-824e-e3e0a2e272a0.png) | 73 | 74 | ## Installation 75 | 76 | ### CocoaPods 77 | 78 | Add this to your Podfile. 79 | 80 | ```ogdl 81 | pod 'AMColorPicker' 82 | ``` 83 | 84 | ### Carthage 85 | 86 | Add this to your Cartfile. 87 | 88 | ```ogdl 89 | github "adventam10/AMColorPicker" 90 | ``` 91 | 92 | ## License 93 | 94 | MIT 95 | -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0E407ADD23547EBB0096FA4A /* AMColorPickerViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AC923547EBB0096FA4A /* AMColorPickerViewController.xib */; }; 11 | 0E407ADE23547EBB0096FA4A /* AMColorPickerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407ACA23547EBB0096FA4A /* AMColorPickerProtocol.swift */; }; 12 | 0E407ADF23547EBB0096FA4A /* AMColorPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407ACB23547EBB0096FA4A /* AMColorPickerViewController.swift */; }; 13 | 0E407AE023547EBB0096FA4A /* AMCP_cursor@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0E407ACD23547EBB0096FA4A /* AMCP_cursor@2x.png */; }; 14 | 0E407AE123547EBB0096FA4A /* AMCP_slider_thumb@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0E407ACE23547EBB0096FA4A /* AMCP_slider_thumb@2x.png */; }; 15 | 0E407AE223547EBB0096FA4A /* AMCP_color_wheel@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 0E407ACF23547EBB0096FA4A /* AMCP_color_wheel@2x.png */; }; 16 | 0E407AE323547EBB0096FA4A /* AMColorPickerAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AD023547EBB0096FA4A /* AMColorPickerAssets.xcassets */; }; 17 | 0E407AE423547EBB0096FA4A /* AMColorPickerWheelView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AD223547EBB0096FA4A /* AMColorPickerWheelView.xib */; }; 18 | 0E407AE523547EBB0096FA4A /* AMColorPickerWheelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AD323547EBB0096FA4A /* AMColorPickerWheelView.swift */; }; 19 | 0E407AE623547EBB0096FA4A /* AMColorPickerTableView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AD423547EBB0096FA4A /* AMColorPickerTableView.xib */; }; 20 | 0E407AE723547EBB0096FA4A /* AMColorPickerTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AD523547EBB0096FA4A /* AMColorPickerTableView.swift */; }; 21 | 0E407AE823547EBB0096FA4A /* AMColorPickerSlider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407AD723547EBB0096FA4A /* AMColorPickerSlider.swift */; }; 22 | 0E407AE923547EBB0096FA4A /* AMColorPickerTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407AD923547EBB0096FA4A /* AMColorPickerTableViewCell.xib */; }; 23 | 0E407AEA23547EBB0096FA4A /* AMColorPickerTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407ADA23547EBB0096FA4A /* AMColorPickerTableViewCell.swift */; }; 24 | 0E407AEB23547EBB0096FA4A /* AMColorPickerRGBSliderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0E407ADB23547EBB0096FA4A /* AMColorPickerRGBSliderView.xib */; }; 25 | 0E407AEC23547EBB0096FA4A /* AMColorPickerRGBSliderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E407ADC23547EBB0096FA4A /* AMColorPickerRGBSliderView.swift */; }; 26 | 0E4753BA201F778D002EA382 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E4753B8201F778D002EA382 /* AppDelegate.swift */; }; 27 | 0E4753BB201F778D002EA382 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E4753B9201F778D002EA382 /* ViewController.swift */; }; 28 | 0E9A09012003848300DD65DB /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0E9A08FF2003848300DD65DB /* Main.storyboard */; }; 29 | 0E9A09032003848300DD65DB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0E9A09022003848300DD65DB /* Assets.xcassets */; }; 30 | 0E9A09062003848300DD65DB /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0E9A09042003848300DD65DB /* LaunchScreen.storyboard */; }; 31 | /* End PBXBuildFile section */ 32 | 33 | /* Begin PBXFileReference section */ 34 | 0E407AC923547EBB0096FA4A /* AMColorPickerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerViewController.xib; sourceTree = ""; }; 35 | 0E407ACA23547EBB0096FA4A /* AMColorPickerProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerProtocol.swift; sourceTree = ""; }; 36 | 0E407ACB23547EBB0096FA4A /* AMColorPickerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerViewController.swift; sourceTree = ""; }; 37 | 0E407ACD23547EBB0096FA4A /* AMCP_cursor@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AMCP_cursor@2x.png"; sourceTree = ""; }; 38 | 0E407ACE23547EBB0096FA4A /* AMCP_slider_thumb@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AMCP_slider_thumb@2x.png"; sourceTree = ""; }; 39 | 0E407ACF23547EBB0096FA4A /* AMCP_color_wheel@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "AMCP_color_wheel@2x.png"; sourceTree = ""; }; 40 | 0E407AD023547EBB0096FA4A /* AMColorPickerAssets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = AMColorPickerAssets.xcassets; sourceTree = ""; }; 41 | 0E407AD223547EBB0096FA4A /* AMColorPickerWheelView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerWheelView.xib; sourceTree = ""; }; 42 | 0E407AD323547EBB0096FA4A /* AMColorPickerWheelView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerWheelView.swift; sourceTree = ""; }; 43 | 0E407AD423547EBB0096FA4A /* AMColorPickerTableView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerTableView.xib; sourceTree = ""; }; 44 | 0E407AD523547EBB0096FA4A /* AMColorPickerTableView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerTableView.swift; sourceTree = ""; }; 45 | 0E407AD723547EBB0096FA4A /* AMColorPickerSlider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerSlider.swift; sourceTree = ""; }; 46 | 0E407AD923547EBB0096FA4A /* AMColorPickerTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerTableViewCell.xib; sourceTree = ""; }; 47 | 0E407ADA23547EBB0096FA4A /* AMColorPickerTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerTableViewCell.swift; sourceTree = ""; }; 48 | 0E407ADB23547EBB0096FA4A /* AMColorPickerRGBSliderView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AMColorPickerRGBSliderView.xib; sourceTree = ""; }; 49 | 0E407ADC23547EBB0096FA4A /* AMColorPickerRGBSliderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AMColorPickerRGBSliderView.swift; sourceTree = ""; }; 50 | 0E4753B8201F778D002EA382 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 51 | 0E4753B9201F778D002EA382 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 52 | 0E9A08F82003848300DD65DB /* SampleAMColorPicker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleAMColorPicker.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 0E9A09002003848300DD65DB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 54 | 0E9A09022003848300DD65DB /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 55 | 0E9A09052003848300DD65DB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 56 | 0E9A09072003848300DD65DB /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 57 | /* End PBXFileReference section */ 58 | 59 | /* Begin PBXFrameworksBuildPhase section */ 60 | 0E9A08F52003848300DD65DB /* Frameworks */ = { 61 | isa = PBXFrameworksBuildPhase; 62 | buildActionMask = 2147483647; 63 | files = ( 64 | ); 65 | runOnlyForDeploymentPostprocessing = 0; 66 | }; 67 | /* End PBXFrameworksBuildPhase section */ 68 | 69 | /* Begin PBXGroup section */ 70 | 0E407AC823547EBB0096FA4A /* Source */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | 0E407AC923547EBB0096FA4A /* AMColorPickerViewController.xib */, 74 | 0E407ACA23547EBB0096FA4A /* AMColorPickerProtocol.swift */, 75 | 0E407ACB23547EBB0096FA4A /* AMColorPickerViewController.swift */, 76 | 0E407ACC23547EBB0096FA4A /* image */, 77 | 0E407AD023547EBB0096FA4A /* AMColorPickerAssets.xcassets */, 78 | 0E407AD123547EBB0096FA4A /* view */, 79 | ); 80 | name = Source; 81 | path = ../../../Source; 82 | sourceTree = ""; 83 | }; 84 | 0E407ACC23547EBB0096FA4A /* image */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 0E407ACD23547EBB0096FA4A /* AMCP_cursor@2x.png */, 88 | 0E407ACE23547EBB0096FA4A /* AMCP_slider_thumb@2x.png */, 89 | 0E407ACF23547EBB0096FA4A /* AMCP_color_wheel@2x.png */, 90 | ); 91 | path = image; 92 | sourceTree = ""; 93 | }; 94 | 0E407AD123547EBB0096FA4A /* view */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 0E407AD223547EBB0096FA4A /* AMColorPickerWheelView.xib */, 98 | 0E407AD323547EBB0096FA4A /* AMColorPickerWheelView.swift */, 99 | 0E407AD423547EBB0096FA4A /* AMColorPickerTableView.xib */, 100 | 0E407AD523547EBB0096FA4A /* AMColorPickerTableView.swift */, 101 | 0E407AD623547EBB0096FA4A /* Slider */, 102 | 0E407AD823547EBB0096FA4A /* Cell */, 103 | 0E407ADB23547EBB0096FA4A /* AMColorPickerRGBSliderView.xib */, 104 | 0E407ADC23547EBB0096FA4A /* AMColorPickerRGBSliderView.swift */, 105 | ); 106 | path = view; 107 | sourceTree = ""; 108 | }; 109 | 0E407AD623547EBB0096FA4A /* Slider */ = { 110 | isa = PBXGroup; 111 | children = ( 112 | 0E407AD723547EBB0096FA4A /* AMColorPickerSlider.swift */, 113 | ); 114 | path = Slider; 115 | sourceTree = ""; 116 | }; 117 | 0E407AD823547EBB0096FA4A /* Cell */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 0E407AD923547EBB0096FA4A /* AMColorPickerTableViewCell.xib */, 121 | 0E407ADA23547EBB0096FA4A /* AMColorPickerTableViewCell.swift */, 122 | ); 123 | path = Cell; 124 | sourceTree = ""; 125 | }; 126 | 0E4753B7201F778D002EA382 /* Classes */ = { 127 | isa = PBXGroup; 128 | children = ( 129 | 0E407AC823547EBB0096FA4A /* Source */, 130 | 0E4753B8201F778D002EA382 /* AppDelegate.swift */, 131 | 0E4753B9201F778D002EA382 /* ViewController.swift */, 132 | ); 133 | path = Classes; 134 | sourceTree = ""; 135 | }; 136 | 0E9A08EF2003848300DD65DB = { 137 | isa = PBXGroup; 138 | children = ( 139 | 0E9A08FA2003848300DD65DB /* SampleAMColorPicker */, 140 | 0E9A08F92003848300DD65DB /* Products */, 141 | ); 142 | sourceTree = ""; 143 | }; 144 | 0E9A08F92003848300DD65DB /* Products */ = { 145 | isa = PBXGroup; 146 | children = ( 147 | 0E9A08F82003848300DD65DB /* SampleAMColorPicker.app */, 148 | ); 149 | name = Products; 150 | sourceTree = ""; 151 | }; 152 | 0E9A08FA2003848300DD65DB /* SampleAMColorPicker */ = { 153 | isa = PBXGroup; 154 | children = ( 155 | 0E4753B7201F778D002EA382 /* Classes */, 156 | 0E9A08FF2003848300DD65DB /* Main.storyboard */, 157 | 0E9A09022003848300DD65DB /* Assets.xcassets */, 158 | 0E9A09042003848300DD65DB /* LaunchScreen.storyboard */, 159 | 0E9A09072003848300DD65DB /* Info.plist */, 160 | ); 161 | path = SampleAMColorPicker; 162 | sourceTree = ""; 163 | }; 164 | /* End PBXGroup section */ 165 | 166 | /* Begin PBXNativeTarget section */ 167 | 0E9A08F72003848300DD65DB /* SampleAMColorPicker */ = { 168 | isa = PBXNativeTarget; 169 | buildConfigurationList = 0E9A090A2003848300DD65DB /* Build configuration list for PBXNativeTarget "SampleAMColorPicker" */; 170 | buildPhases = ( 171 | 0E9A08F42003848300DD65DB /* Sources */, 172 | 0E9A08F52003848300DD65DB /* Frameworks */, 173 | 0E9A08F62003848300DD65DB /* Resources */, 174 | ); 175 | buildRules = ( 176 | ); 177 | dependencies = ( 178 | ); 179 | name = SampleAMColorPicker; 180 | productName = SampleAMColorPicker; 181 | productReference = 0E9A08F82003848300DD65DB /* SampleAMColorPicker.app */; 182 | productType = "com.apple.product-type.application"; 183 | }; 184 | /* End PBXNativeTarget section */ 185 | 186 | /* Begin PBXProject section */ 187 | 0E9A08F02003848300DD65DB /* Project object */ = { 188 | isa = PBXProject; 189 | attributes = { 190 | LastSwiftUpdateCheck = 0920; 191 | LastUpgradeCheck = 0940; 192 | ORGANIZATIONNAME = am10; 193 | TargetAttributes = { 194 | 0E9A08F72003848300DD65DB = { 195 | CreatedOnToolsVersion = 9.2; 196 | LastSwiftMigration = 1020; 197 | ProvisioningStyle = Manual; 198 | }; 199 | }; 200 | }; 201 | buildConfigurationList = 0E9A08F32003848300DD65DB /* Build configuration list for PBXProject "SampleAMColorPicker" */; 202 | compatibilityVersion = "Xcode 8.0"; 203 | developmentRegion = en; 204 | hasScannedForEncodings = 0; 205 | knownRegions = ( 206 | en, 207 | Base, 208 | ); 209 | mainGroup = 0E9A08EF2003848300DD65DB; 210 | productRefGroup = 0E9A08F92003848300DD65DB /* Products */; 211 | projectDirPath = ""; 212 | projectRoot = ""; 213 | targets = ( 214 | 0E9A08F72003848300DD65DB /* SampleAMColorPicker */, 215 | ); 216 | }; 217 | /* End PBXProject section */ 218 | 219 | /* Begin PBXResourcesBuildPhase section */ 220 | 0E9A08F62003848300DD65DB /* Resources */ = { 221 | isa = PBXResourcesBuildPhase; 222 | buildActionMask = 2147483647; 223 | files = ( 224 | 0E407AE423547EBB0096FA4A /* AMColorPickerWheelView.xib in Resources */, 225 | 0E9A09062003848300DD65DB /* LaunchScreen.storyboard in Resources */, 226 | 0E407AE023547EBB0096FA4A /* AMCP_cursor@2x.png in Resources */, 227 | 0E9A09032003848300DD65DB /* Assets.xcassets in Resources */, 228 | 0E407AE123547EBB0096FA4A /* AMCP_slider_thumb@2x.png in Resources */, 229 | 0E407ADD23547EBB0096FA4A /* AMColorPickerViewController.xib in Resources */, 230 | 0E407AE223547EBB0096FA4A /* AMCP_color_wheel@2x.png in Resources */, 231 | 0E407AE923547EBB0096FA4A /* AMColorPickerTableViewCell.xib in Resources */, 232 | 0E407AE623547EBB0096FA4A /* AMColorPickerTableView.xib in Resources */, 233 | 0E407AE323547EBB0096FA4A /* AMColorPickerAssets.xcassets in Resources */, 234 | 0E9A09012003848300DD65DB /* Main.storyboard in Resources */, 235 | 0E407AEB23547EBB0096FA4A /* AMColorPickerRGBSliderView.xib in Resources */, 236 | ); 237 | runOnlyForDeploymentPostprocessing = 0; 238 | }; 239 | /* End PBXResourcesBuildPhase section */ 240 | 241 | /* Begin PBXSourcesBuildPhase section */ 242 | 0E9A08F42003848300DD65DB /* Sources */ = { 243 | isa = PBXSourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | 0E407ADE23547EBB0096FA4A /* AMColorPickerProtocol.swift in Sources */, 247 | 0E407AE723547EBB0096FA4A /* AMColorPickerTableView.swift in Sources */, 248 | 0E407AEA23547EBB0096FA4A /* AMColorPickerTableViewCell.swift in Sources */, 249 | 0E4753BB201F778D002EA382 /* ViewController.swift in Sources */, 250 | 0E407ADF23547EBB0096FA4A /* AMColorPickerViewController.swift in Sources */, 251 | 0E407AEC23547EBB0096FA4A /* AMColorPickerRGBSliderView.swift in Sources */, 252 | 0E4753BA201F778D002EA382 /* AppDelegate.swift in Sources */, 253 | 0E407AE823547EBB0096FA4A /* AMColorPickerSlider.swift in Sources */, 254 | 0E407AE523547EBB0096FA4A /* AMColorPickerWheelView.swift in Sources */, 255 | ); 256 | runOnlyForDeploymentPostprocessing = 0; 257 | }; 258 | /* End PBXSourcesBuildPhase section */ 259 | 260 | /* Begin PBXVariantGroup section */ 261 | 0E9A08FF2003848300DD65DB /* Main.storyboard */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | 0E9A09002003848300DD65DB /* Base */, 265 | ); 266 | name = Main.storyboard; 267 | sourceTree = ""; 268 | }; 269 | 0E9A09042003848300DD65DB /* LaunchScreen.storyboard */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | 0E9A09052003848300DD65DB /* Base */, 273 | ); 274 | name = LaunchScreen.storyboard; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | 0E9A09082003848300DD65DB /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_ANALYZER_NONNULL = YES; 285 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 286 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 287 | CLANG_CXX_LIBRARY = "libc++"; 288 | CLANG_ENABLE_MODULES = YES; 289 | CLANG_ENABLE_OBJC_ARC = YES; 290 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 291 | CLANG_WARN_BOOL_CONVERSION = YES; 292 | CLANG_WARN_COMMA = YES; 293 | CLANG_WARN_CONSTANT_CONVERSION = YES; 294 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 295 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 296 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 297 | CLANG_WARN_EMPTY_BODY = YES; 298 | CLANG_WARN_ENUM_CONVERSION = YES; 299 | CLANG_WARN_INFINITE_RECURSION = YES; 300 | CLANG_WARN_INT_CONVERSION = YES; 301 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 302 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 303 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 304 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 305 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 306 | CLANG_WARN_STRICT_PROTOTYPES = YES; 307 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 308 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 309 | CLANG_WARN_UNREACHABLE_CODE = YES; 310 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 311 | CODE_SIGN_IDENTITY = "iPhone Developer"; 312 | COPY_PHASE_STRIP = NO; 313 | DEBUG_INFORMATION_FORMAT = dwarf; 314 | ENABLE_STRICT_OBJC_MSGSEND = YES; 315 | ENABLE_TESTABILITY = YES; 316 | GCC_C_LANGUAGE_STANDARD = gnu11; 317 | GCC_DYNAMIC_NO_PIC = NO; 318 | GCC_NO_COMMON_BLOCKS = YES; 319 | GCC_OPTIMIZATION_LEVEL = 0; 320 | GCC_PREPROCESSOR_DEFINITIONS = ( 321 | "DEBUG=1", 322 | "$(inherited)", 323 | ); 324 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 325 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 326 | GCC_WARN_UNDECLARED_SELECTOR = YES; 327 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 328 | GCC_WARN_UNUSED_FUNCTION = YES; 329 | GCC_WARN_UNUSED_VARIABLE = YES; 330 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 331 | MTL_ENABLE_DEBUG_INFO = YES; 332 | ONLY_ACTIVE_ARCH = YES; 333 | SDKROOT = iphoneos; 334 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 335 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 336 | }; 337 | name = Debug; 338 | }; 339 | 0E9A09092003848300DD65DB /* Release */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | CLANG_ANALYZER_NONNULL = YES; 344 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 345 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 346 | CLANG_CXX_LIBRARY = "libc++"; 347 | CLANG_ENABLE_MODULES = YES; 348 | CLANG_ENABLE_OBJC_ARC = YES; 349 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 350 | CLANG_WARN_BOOL_CONVERSION = YES; 351 | CLANG_WARN_COMMA = YES; 352 | CLANG_WARN_CONSTANT_CONVERSION = YES; 353 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 354 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 355 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 356 | CLANG_WARN_EMPTY_BODY = YES; 357 | CLANG_WARN_ENUM_CONVERSION = YES; 358 | CLANG_WARN_INFINITE_RECURSION = YES; 359 | CLANG_WARN_INT_CONVERSION = YES; 360 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 361 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 362 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 363 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 364 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 365 | CLANG_WARN_STRICT_PROTOTYPES = YES; 366 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 367 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 368 | CLANG_WARN_UNREACHABLE_CODE = YES; 369 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 370 | CODE_SIGN_IDENTITY = "iPhone Developer"; 371 | COPY_PHASE_STRIP = NO; 372 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 373 | ENABLE_NS_ASSERTIONS = NO; 374 | ENABLE_STRICT_OBJC_MSGSEND = YES; 375 | GCC_C_LANGUAGE_STANDARD = gnu11; 376 | GCC_NO_COMMON_BLOCKS = YES; 377 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 378 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 379 | GCC_WARN_UNDECLARED_SELECTOR = YES; 380 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 381 | GCC_WARN_UNUSED_FUNCTION = YES; 382 | GCC_WARN_UNUSED_VARIABLE = YES; 383 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 384 | MTL_ENABLE_DEBUG_INFO = NO; 385 | SDKROOT = iphoneos; 386 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 387 | VALIDATE_PRODUCT = YES; 388 | }; 389 | name = Release; 390 | }; 391 | 0E9A090B2003848300DD65DB /* Debug */ = { 392 | isa = XCBuildConfiguration; 393 | buildSettings = { 394 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 395 | CODE_SIGN_IDENTITY = "iPhone Developer"; 396 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 397 | CODE_SIGN_STYLE = Manual; 398 | DEVELOPMENT_TEAM = ""; 399 | INFOPLIST_FILE = SampleAMColorPicker/Info.plist; 400 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 401 | PRODUCT_BUNDLE_IDENTIFIER = am10.SampleAMColorPicker; 402 | PRODUCT_NAME = "$(TARGET_NAME)"; 403 | PROVISIONING_PROFILE_SPECIFIER = ""; 404 | SWIFT_VERSION = 5.0; 405 | TARGETED_DEVICE_FAMILY = "1,2"; 406 | }; 407 | name = Debug; 408 | }; 409 | 0E9A090C2003848300DD65DB /* Release */ = { 410 | isa = XCBuildConfiguration; 411 | buildSettings = { 412 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 413 | CODE_SIGN_IDENTITY = "iPhone Developer"; 414 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 415 | CODE_SIGN_STYLE = Manual; 416 | DEVELOPMENT_TEAM = ""; 417 | INFOPLIST_FILE = SampleAMColorPicker/Info.plist; 418 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 419 | PRODUCT_BUNDLE_IDENTIFIER = am10.SampleAMColorPicker; 420 | PRODUCT_NAME = "$(TARGET_NAME)"; 421 | PROVISIONING_PROFILE_SPECIFIER = ""; 422 | SWIFT_VERSION = 5.0; 423 | TARGETED_DEVICE_FAMILY = "1,2"; 424 | }; 425 | name = Release; 426 | }; 427 | /* End XCBuildConfiguration section */ 428 | 429 | /* Begin XCConfigurationList section */ 430 | 0E9A08F32003848300DD65DB /* Build configuration list for PBXProject "SampleAMColorPicker" */ = { 431 | isa = XCConfigurationList; 432 | buildConfigurations = ( 433 | 0E9A09082003848300DD65DB /* Debug */, 434 | 0E9A09092003848300DD65DB /* Release */, 435 | ); 436 | defaultConfigurationIsVisible = 0; 437 | defaultConfigurationName = Release; 438 | }; 439 | 0E9A090A2003848300DD65DB /* Build configuration list for PBXNativeTarget "SampleAMColorPicker" */ = { 440 | isa = XCConfigurationList; 441 | buildConfigurations = ( 442 | 0E9A090B2003848300DD65DB /* Debug */, 443 | 0E9A090C2003848300DD65DB /* Release */, 444 | ); 445 | defaultConfigurationIsVisible = 0; 446 | defaultConfigurationName = Release; 447 | }; 448 | /* End XCConfigurationList section */ 449 | }; 450 | rootObject = 0E9A08F02003848300DD65DB /* Project object */; 451 | } 452 | -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "icon20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "icon20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "icon29@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "icon29@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "40x40", 29 | "idiom" : "iphone", 30 | "filename" : "icon40@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "icon40@3x.png", 37 | "scale" : "3x" 38 | }, 39 | { 40 | "size" : "60x60", 41 | "idiom" : "iphone", 42 | "filename" : "icon60@2x.png", 43 | "scale" : "2x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "icon60@3x.png", 49 | "scale" : "3x" 50 | }, 51 | { 52 | "size" : "20x20", 53 | "idiom" : "ipad", 54 | "filename" : "icon20.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "icon20@2x-1.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "29x29", 65 | "idiom" : "ipad", 66 | "filename" : "icon29.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "icon29@2x-1.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "40x40", 77 | "idiom" : "ipad", 78 | "filename" : "icon40.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "icon40@2x-1.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "76x76", 89 | "idiom" : "ipad", 90 | "filename" : "icon76.png", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "icon76@2x.png", 97 | "scale" : "2x" 98 | }, 99 | { 100 | "size" : "83.5x83.5", 101 | "idiom" : "ipad", 102 | "filename" : "icon835@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "1024x1024", 107 | "idiom" : "ios-marketing", 108 | "filename" : "icon1024.png", 109 | "scale" : "1x" 110 | } 111 | ], 112 | "info" : { 113 | "version" : 1, 114 | "author" : "xcode" 115 | } 116 | } -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon1024.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon20.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon20@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon20@2x-1.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon20@2x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon20@3x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon29.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon29@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon29@2x-1.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon29@2x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon29@3x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon40.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon40@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon40@2x-1.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon40@2x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon40@3x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon60@2x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon60@3x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon76.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon76@2x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon835@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/AppIcon.appiconset/icon835@2x.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/logo_typeA.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "logotype-a.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/logo_typeA.imageset/logotype-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/SampleAMColorPicker/SampleAMColorPicker/Assets.xcassets/logo_typeA.imageset/logotype-a.png -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 35 | 44 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Classes/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // SampleAMColorPicker 4 | // 5 | // Created by am10 on 2018/01/08. 6 | // Copyright © 2018年 am10. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Classes/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // SampleAMColorPicker 4 | // 5 | // Created by am10 on 2018/01/08. 6 | // Copyright © 2018年 am10. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | @IBOutlet weak private var colorView: UIView! 14 | 15 | override func viewDidLoad() { 16 | super.viewDidLoad() 17 | // Do any additional setup after loading the view, typically from a nib. 18 | 19 | } 20 | 21 | @IBAction func tappedModalButton(_ sender: Any) { 22 | let colorPickerViewController = AMColorPickerViewController() 23 | colorPickerViewController.selectedColor = colorView.backgroundColor! 24 | colorPickerViewController.delegate = self 25 | present(colorPickerViewController, animated: true, completion: nil) 26 | } 27 | 28 | @IBAction func tappedPushButton(_ sender: Any) { 29 | let colorPickerViewController = AMColorPickerViewController() 30 | colorPickerViewController.isCloseButtonShown = false 31 | colorPickerViewController.selectedColor = colorView.backgroundColor! 32 | colorPickerViewController.delegate = self 33 | navigationController?.pushViewController(colorPickerViewController, animated: true) 34 | } 35 | 36 | @IBAction func tappedPopoverButton(_ sender: Any) { 37 | let colorPickerViewController = AMColorPickerViewController() 38 | colorPickerViewController.isCloseButtonShown = false 39 | colorPickerViewController.isSelectedColorShown = false 40 | colorPickerViewController.selectedColor = colorView.backgroundColor! 41 | colorPickerViewController.delegate = self 42 | colorPickerViewController.modalPresentationStyle = .popover 43 | colorPickerViewController.preferredContentSize = CGSize(width: 300, height: 380) 44 | 45 | let presentationController = colorPickerViewController.popoverPresentationController 46 | presentationController?.delegate = self 47 | presentationController?.permittedArrowDirections = .any 48 | let button = sender as! UIButton 49 | presentationController?.sourceView = button 50 | presentationController?.sourceRect = button.bounds 51 | present(colorPickerViewController, animated: true, completion: nil) 52 | } 53 | } 54 | 55 | extension ViewController: AMColorPickerDelegate { 56 | func colorPicker(_ colorPicker: AMColorPicker, didSelect color: UIColor) { 57 | colorView.backgroundColor = color 58 | } 59 | } 60 | 61 | extension ViewController: UIPopoverPresentationControllerDelegate { 62 | func adaptivePresentationStyle(for controller: UIPresentationController, 63 | traitCollection: UITraitCollection) -> UIModalPresentationStyle { 64 | return .none 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /SampleAMColorPicker/SampleAMColorPicker/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Source/AMColorPickerAssets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Source/AMColorPickerAssets.xcassets/textColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | }, 6 | "colors" : [ 7 | { 8 | "idiom" : "universal", 9 | "color" : { 10 | "color-space" : "srgb", 11 | "components" : { 12 | "red" : "0.302", 13 | "alpha" : "1.000", 14 | "blue" : "0.302", 15 | "green" : "0.302" 16 | } 17 | } 18 | }, 19 | { 20 | "idiom" : "universal", 21 | "appearances" : [ 22 | { 23 | "appearance" : "luminosity", 24 | "value" : "light" 25 | } 26 | ], 27 | "color" : { 28 | "color-space" : "srgb", 29 | "components" : { 30 | "red" : "0.302", 31 | "alpha" : "1.000", 32 | "blue" : "0.302", 33 | "green" : "0.302" 34 | } 35 | } 36 | }, 37 | { 38 | "idiom" : "universal", 39 | "appearances" : [ 40 | { 41 | "appearance" : "luminosity", 42 | "value" : "dark" 43 | } 44 | ], 45 | "color" : { 46 | "color-space" : "srgb", 47 | "components" : { 48 | "red" : "0.965", 49 | "alpha" : "1.000", 50 | "blue" : "0.961", 51 | "green" : "0.961" 52 | } 53 | } 54 | } 55 | ] 56 | } -------------------------------------------------------------------------------- /Source/AMColorPickerProtocol.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AMColorPickerProtocol.swift 3 | // SampleAMColorPicker 4 | // 5 | // Created by am10 on 2019/04/21. 6 | // Copyright © 2019 am10. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public protocol AMColorPicker: NSObject { 12 | } 13 | 14 | public protocol AMColorPickerDelegate: class { 15 | func colorPicker(_ colorPicker: AMColorPicker, didSelect color: UIColor) 16 | } 17 | 18 | extension UIColor { 19 | convenience init(hex: String, alpha: CGFloat) { 20 | let hexString = hex.replacingOccurrences(of: "#", with: "") 21 | let scanner = Scanner(string: hexString) 22 | var color: UInt32 = 0 23 | if scanner.scanHexInt32(&color) { 24 | let red = CGFloat((color & 0xFF0000) >> 16) / 255.0 25 | let green = CGFloat((color & 0x00FF00) >> 8) / 255.0 26 | let blue = CGFloat(color & 0x0000FF) / 255.0 27 | self.init(red: red, green: green, blue: blue, alpha: alpha) 28 | } else { 29 | assertionFailure("invalid hex string") 30 | self.init() 31 | } 32 | } 33 | 34 | var rgba: (red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) { 35 | var red: CGFloat = 0 36 | var green: CGFloat = 0 37 | var blue: CGFloat = 0 38 | var alpha: CGFloat = 0 39 | self.getRed(&red, green: &green, blue: &blue, alpha: &alpha) 40 | return (red: red, green: green, blue: blue, alpha: alpha) 41 | } 42 | 43 | var hsba: (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) { 44 | var hue:CGFloat = 0 45 | var saturation:CGFloat = 0 46 | var brightness:CGFloat = 0 47 | var alpha:CGFloat = 0 48 | self.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha) 49 | return (hue: hue, saturation: saturation, brightness: brightness, alpha: alpha) 50 | } 51 | 52 | var colorCode: String { 53 | var red: CGFloat = 0 54 | var green: CGFloat = 0 55 | var blue: CGFloat = 0 56 | var alpha: CGFloat = 0 57 | self.getRed(&red, green: &green, blue: &blue, alpha: &alpha) 58 | let rgb = (Int)(red*255)<<16 | (Int)(green*255)<<8 | (Int)(blue*255)<<0 59 | return String(format: "%06x", rgb) 60 | } 61 | } 62 | 63 | extension CGFloat { 64 | var colorFormatted: String { 65 | return String(format: "%.0f", self) 66 | } 67 | } 68 | 69 | extension Float { 70 | var colorFormatted: String { 71 | return String(format: "%.0f", self) 72 | } 73 | } 74 | 75 | public class XibLioadView: UIView { 76 | override public init(frame: CGRect) { 77 | super.init(frame: frame) 78 | loadNib() 79 | } 80 | 81 | required public init(coder aDecoder: NSCoder) { 82 | super.init(coder: aDecoder)! 83 | loadNib() 84 | } 85 | 86 | private func loadNib() { 87 | let bundle = Bundle(for: type(of: self)) 88 | let nibName = type(of: self).description().components(separatedBy: ".").last! 89 | let view = bundle.loadNibNamed(nibName, owner: self, options: nil)?.first as! UIView 90 | view.frame = bounds 91 | view.translatesAutoresizingMaskIntoConstraints = true 92 | view.autoresizingMask = [.flexibleWidth, .flexibleHeight] 93 | addSubview(view) 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Source/AMColorPickerViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AMColorPickerViewController.swift 3 | // AMColorPicker, https://github.com/adventam10/AMColorPicker 4 | // 5 | // Created by am10 on 2018/01/03. 6 | // Copyright © 2018年 am10. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class AMColorPickerViewController: UIViewController, AMColorPicker { 12 | 13 | enum SegmentIndex: Int { 14 | case picker = 0 15 | case table = 1 16 | case slider = 2 17 | } 18 | 19 | weak public var delegate: AMColorPickerDelegate? 20 | public var selectedColor: UIColor = .white 21 | public var isCloseButtonShown: Bool = true { 22 | didSet { 23 | closeButton?.isHidden = !isCloseButtonShown 24 | } 25 | } 26 | public var isSelectedColorShown: Bool = true { 27 | didSet { 28 | cpWheelView?.isSelectedColorShown = isSelectedColorShown 29 | cpTableView?.isSelectedColorShown = isSelectedColorShown 30 | cpSliderView?.isSelectedColorShown = isSelectedColorShown 31 | } 32 | } 33 | public var predefinedColors: [AMCPCellInfo] = [] { 34 | didSet { 35 | cpTableView?.dataList = predefinedColors 36 | cpTableView?.reloadTable() 37 | } 38 | } 39 | 40 | @IBOutlet weak private var closeButton: UIButton! 41 | @IBOutlet weak private var cpWheelView: AMColorPickerWheelView! 42 | @IBOutlet weak private var cpTableView: AMColorPickerTableView! 43 | @IBOutlet weak private var cpSliderView: AMColorPickerRGBSliderView! 44 | @IBOutlet weak private var segment: UISegmentedControl! 45 | 46 | required public init(coder aDecoder: NSCoder) { 47 | super.init(coder: aDecoder)! 48 | } 49 | 50 | override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: Bundle!) { 51 | let bundle = Bundle(for: AMColorPickerViewController.self) 52 | super.init(nibName: "AMColorPickerViewController", bundle: bundle) 53 | } 54 | 55 | convenience init() { 56 | self.init(nibName: nil, bundle: nil) 57 | } 58 | 59 | override public func viewDidLoad() { 60 | super.viewDidLoad() 61 | 62 | // Do any additional setup after loading the view. 63 | closeButton.isHidden = !isCloseButtonShown 64 | cpTableView.isSelectedColorShown = isSelectedColorShown 65 | cpSliderView.isSelectedColorShown = isSelectedColorShown 66 | cpWheelView.isSelectedColorShown = isSelectedColorShown 67 | 68 | cpTableView.delegate = self 69 | cpSliderView.delegate = self 70 | cpWheelView.delegate = self 71 | 72 | cpSliderView.selectedColor = selectedColor 73 | cpTableView.selectedColor = selectedColor 74 | cpWheelView.selectedColor = selectedColor 75 | } 76 | 77 | // MARK:- IBAction 78 | @IBAction private func changedSegment(_ sender: UISegmentedControl) { 79 | cpSliderView.closeKeyboard() 80 | switch SegmentIndex(rawValue: sender.selectedSegmentIndex)! { 81 | case .picker: 82 | cpWheelView.isHidden = false 83 | cpTableView.isHidden = true 84 | cpSliderView.isHidden = true 85 | case .slider: 86 | cpWheelView.isHidden = true 87 | cpTableView.isHidden = true 88 | cpSliderView.isHidden = false 89 | case .table: 90 | cpTableView.reloadTable() 91 | cpWheelView.isHidden = true 92 | cpTableView.isHidden = false 93 | cpSliderView.isHidden = true 94 | } 95 | } 96 | 97 | @IBAction private func tappedCloseButton(_ sender: UIButton) { 98 | dismiss(animated: true, completion: nil) 99 | } 100 | } 101 | 102 | extension AMColorPickerViewController: AMColorPickerDelegate { 103 | public func colorPicker(_ colorPicker: AMColorPicker, didSelect color: UIColor) { 104 | if colorPicker == cpTableView { 105 | cpSliderView.selectedColor = color 106 | cpWheelView.selectedColor = color 107 | } else if colorPicker == cpSliderView { 108 | cpTableView.selectedColor = color 109 | cpWheelView.selectedColor = color 110 | } else if colorPicker == cpWheelView { 111 | cpTableView.selectedColor = color 112 | cpSliderView.selectedColor = color 113 | } 114 | 115 | delegate?.colorPicker(self, didSelect: color) 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /Source/AMColorPickerViewController.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Source/image/AMCP_color_wheel@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/Source/image/AMCP_color_wheel@2x.png -------------------------------------------------------------------------------- /Source/image/AMCP_cursor@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/Source/image/AMCP_cursor@2x.png -------------------------------------------------------------------------------- /Source/image/AMCP_slider_thumb@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/Source/image/AMCP_slider_thumb@2x.png -------------------------------------------------------------------------------- /Source/view/AMColorPickerRGBSliderView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AMColorPickerRGBSliderView.swift 3 | // AMColorPicker, https://github.com/adventam10/AMColorPicker 4 | // 5 | // Created by am10 on 2018/01/03. 6 | // Copyright © 2018年 am10. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class AMColorPickerRGBSliderView: XibLioadView, AMColorPicker { 12 | 13 | weak public var delegate: AMColorPickerDelegate? 14 | public var isSelectedColorShown: Bool = true { 15 | didSet { 16 | headerView?.isHidden = !isSelectedColorShown 17 | } 18 | } 19 | 20 | public var selectedColor: UIColor = .white { 21 | didSet { 22 | displayColor(selectedColor) 23 | } 24 | } 25 | 26 | override public var bounds: CGRect { 27 | didSet { 28 | rgbSliderStackView.spacing = bounds.height < 488 ? 16 : 32 29 | if isKeyboardShown && bounds.height < 200 { 30 | // when keyboard is shown (popover style) 31 | rgbSliderStackView.isHidden = true 32 | opacityStackView.isHidden = true 33 | } else { 34 | rgbSliderStackView.isHidden = false 35 | opacityStackView.isHidden = false 36 | } 37 | } 38 | } 39 | 40 | @IBOutlet weak private var headerView: UIView! 41 | @IBOutlet weak private var redSlider: AMColorPickerSlider! 42 | @IBOutlet weak private var greenSlider: AMColorPickerSlider! 43 | @IBOutlet weak private var blueSlider: AMColorPickerSlider! 44 | @IBOutlet weak private var opacitySlider: UISlider! 45 | @IBOutlet weak private var rgbSliderStackView: UIStackView! 46 | @IBOutlet weak private var redLabel: UILabel! 47 | @IBOutlet weak private var greenLabel: UILabel! 48 | @IBOutlet weak private var blueLabel: UILabel! 49 | @IBOutlet weak private var opacityLabel: UILabel! 50 | @IBOutlet weak private var colorView: UIView! 51 | @IBOutlet weak private var opacityStackView: UIStackView! 52 | @IBOutlet weak private var hexTextField: UITextField! { 53 | didSet { 54 | hexTextField.addTarget(self, action: #selector(self.didChange(textField:)), for: .editingChanged) 55 | hexTextField.delegate = self 56 | 57 | let notification = NotificationCenter.default 58 | notification.addObserver(self, selector: #selector(keyboardWillShow(_:)), 59 | name: UIResponder.keyboardWillShowNotification, object: nil) 60 | notification.addObserver(self, selector: #selector(keyboardWillHide(_:)), 61 | name: UIResponder.keyboardWillHideNotification, object: nil) 62 | } 63 | } 64 | 65 | private var isKeyboardShown: Bool = false 66 | private var previousText = "" 67 | 68 | private let colorCodeLength = 6 69 | private let colorCodeCharacterSet = CharacterSet(charactersIn: "0123456789abcdef") 70 | 71 | // MARK:- UITextField Action 72 | @objc func didChange(textField: UITextField) { 73 | // Retrieve the inputted characters 74 | guard let newText = textField.text else { 75 | return 76 | } 77 | if !colorCodeCharacterSet.isSuperset(of: CharacterSet(charactersIn: newText.lowercased())) { 78 | textField.text = previousText 79 | return 80 | } 81 | if newText.count != colorCodeLength { 82 | return 83 | } 84 | didSelect(color: UIColor(hex: newText, alpha: CGFloat(opacitySlider.value) / 100.0)) 85 | } 86 | 87 | // MARK:- Keyboard Notification 88 | @objc func keyboardWillShow(_ notification: Notification?) { 89 | isKeyboardShown = true 90 | } 91 | 92 | @objc func keyboardWillHide(_ notification: Notification?) { 93 | isKeyboardShown = false 94 | } 95 | 96 | // MARK:- IBAction 97 | @IBAction private func changedSlider(_ slider: UISlider) { 98 | let red = CGFloat(redSlider.value) / 255.0 99 | let green = CGFloat(greenSlider.value) / 255.0 100 | let blue = CGFloat(blueSlider.value) / 255.0 101 | let alpha = CGFloat(opacitySlider.value) / 100.0 102 | didSelect(color: UIColor(red: red, green: green, blue: blue, alpha: alpha)) 103 | } 104 | 105 | // MARK:- SetColor 106 | private func didSelect(color: UIColor) { 107 | selectedColor = color 108 | delegate?.colorPicker(self, didSelect: color) 109 | } 110 | 111 | private func setSliderColor(color: UIColor) { 112 | let rgba = color.rgba 113 | redSlider.setGradient(startColor: .init(red: 0.0, green: rgba.green, blue: rgba.blue, alpha: 1.0), 114 | endColor: .init(red: 1.0, green: rgba.green, blue: rgba.blue, alpha: 1.0)) 115 | blueSlider.setGradient(startColor: .init(red: rgba.red, green: rgba.green, blue: 0.0, alpha: 1.0), 116 | endColor: .init(red: rgba.red, green: rgba.green, blue: 1.0, alpha: 1.0)) 117 | greenSlider.setGradient(startColor: .init(red: rgba.red, green: 0.0, blue: rgba.blue, alpha: 1.0), 118 | endColor: .init(red: rgba.red, green: 1.0, blue: rgba.blue, alpha: 1.0)) 119 | } 120 | 121 | private func displayColor(_ color: UIColor) { 122 | colorView.backgroundColor = color 123 | let rgba = color.rgba 124 | let red = rgba.red * 255 125 | let green = rgba.green * 255 126 | let blue = rgba.blue * 255 127 | let alpha = rgba.alpha * 100 128 | redLabel.text = red.colorFormatted 129 | greenLabel.text = green.colorFormatted 130 | blueLabel.text = blue.colorFormatted 131 | opacityLabel.text = alpha.colorFormatted 132 | 133 | redSlider.value = Float(red) 134 | greenSlider.value = Float(green) 135 | blueSlider.value = Float(blue) 136 | opacitySlider.value = Float(alpha) 137 | 138 | hexTextField.text = color.colorCode 139 | setSliderColor(color: color) 140 | } 141 | 142 | // MARK:- Close 143 | func closeKeyboard() { 144 | hexTextField.resignFirstResponder() 145 | } 146 | } 147 | 148 | extension AMColorPickerRGBSliderView: UITextFieldDelegate { 149 | public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, 150 | replacementString string: String) -> Bool { 151 | // Get the inputted text 152 | let currentText = textField.text ?? "" 153 | let prospectiveText = (currentText as NSString).replacingCharacters(in: range, with: string) 154 | 155 | // Determine the number of characters 156 | if prospectiveText.count > colorCodeLength { 157 | return false 158 | } 159 | previousText = currentText 160 | return true 161 | } 162 | 163 | public func textFieldShouldReturn(_ textField: UITextField) -> Bool { 164 | textField.resignFirstResponder() 165 | return true 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /Source/view/AMColorPickerRGBSliderView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /Source/view/AMColorPickerTableView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AMColorPickerTableView.swift 3 | // AMColorPicker, https://github.com/adventam10/AMColorPicker 4 | // 5 | // Created by am10 on 2018/01/03. 6 | // Copyright © 2018年 am10. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class AMColorPickerTableView: XibLioadView, AMColorPicker { 12 | 13 | weak public var delegate: AMColorPickerDelegate? 14 | public var isSelectedColorShown: Bool = true { 15 | didSet { 16 | headerView?.isHidden = !isSelectedColorShown 17 | } 18 | } 19 | public var selectedColor: UIColor = .white { 20 | didSet { 21 | displayColor(selectedColor) 22 | } 23 | } 24 | 25 | @IBOutlet weak private var headerView: UIView! 26 | @IBOutlet weak private var opacityLabel: UILabel! 27 | @IBOutlet weak private var opacitySlider: UISlider! 28 | @IBOutlet weak private var colorView: UIView! 29 | @IBOutlet weak private var tableView: UITableView! { 30 | didSet { 31 | tableView.delegate = self 32 | tableView.dataSource = self 33 | let nib = UINib(nibName: "AMColorPickerTableViewCell", bundle: Bundle(for: AMColorPickerTableView.self)) 34 | tableView.register(nib, forCellReuseIdentifier: cellIdentifier) 35 | tableView.tableFooterView = UIView() 36 | } 37 | } 38 | 39 | private let cellIdentifier = "AMColorPickerTableViewCell" 40 | var dataList: [AMCPCellInfo] = [ 41 | .init(title: "Black", color: .black), .init(title: "Blue", color: .blue), 42 | .init(title: "Brown", color: .brown), .init(title: "Cyan", color: .cyan), 43 | .init(title: "Green", color: .green), .init(title: "Magenta", color: .magenta), 44 | .init(title: "Orange", color: .orange), .init(title: "Purple", color: .purple), 45 | .init(title: "Red", color: .red), .init(title: "Yellow", color: .yellow), 46 | .init(title: "White", color: .white) 47 | ] 48 | 49 | // MARK:- IBAction 50 | @IBAction private func changedOpacitySlider(_ slider: UISlider) { 51 | didSelect(color: selectedColor) 52 | } 53 | 54 | // MARK:- SetColor 55 | private func didSelect(color: UIColor) { 56 | let rgba = color.rgba 57 | let alpha = CGFloat(opacitySlider.value) / 100.0 58 | selectedColor = UIColor(red: rgba.red, green: rgba.green, blue: rgba.blue, alpha: alpha) 59 | delegate?.colorPicker(self, didSelect: selectedColor) 60 | } 61 | 62 | private func displayColor(_ color: UIColor) { 63 | colorView.backgroundColor = color 64 | let alpha = color.rgba.alpha * 100 65 | opacityLabel.text = alpha.colorFormatted 66 | opacitySlider.value = Float(alpha) 67 | } 68 | 69 | // MARK:- Reload 70 | public func reloadTable() { 71 | tableView.reloadData() 72 | tableView.setContentOffset(.zero, animated: false) 73 | } 74 | } 75 | 76 | extension AMColorPickerTableView: UITableViewDelegate { 77 | public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 78 | didSelect(color: dataList[indexPath.row].color) 79 | } 80 | } 81 | 82 | extension AMColorPickerTableView: UITableViewDataSource { 83 | public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { 84 | return dataList.count 85 | } 86 | 87 | public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 88 | let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! AMColorPickerTableViewCell 89 | cell.info = dataList[indexPath.row] 90 | return cell 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Source/view/AMColorPickerTableView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | -------------------------------------------------------------------------------- /Source/view/AMColorPickerWheelView.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AMColorPickerWheelView.swift 3 | // AMColorPicker, https://github.com/adventam10/AMColorPicker 4 | // 5 | // Created by am10 on 2018/01/04. 6 | // Copyright © 2018年 am10. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public class AMColorPickerWheelView: XibLioadView, AMColorPicker { 12 | 13 | weak public var delegate: AMColorPickerDelegate? 14 | public var isSelectedColorShown: Bool = true { 15 | didSet { 16 | headerView?.isHidden = !isSelectedColorShown 17 | } 18 | } 19 | public var selectedColor: UIColor = .white { 20 | didSet { 21 | displayColor(selectedColor) 22 | } 23 | } 24 | 25 | @IBOutlet weak private var headerView: UIView! 26 | @IBOutlet weak private var opacityLabel: UILabel! 27 | @IBOutlet weak private var brightnessLabel: UILabel! 28 | @IBOutlet weak private var opacitySlider: UISlider! 29 | @IBOutlet weak private var colorView: UIView! 30 | @IBOutlet weak private var brightnessSlider: AMColorPickerSlider! 31 | @IBOutlet weak private var colorPickerImageView: UIImageView! { 32 | didSet { 33 | colorPickerImageView.isUserInteractionEnabled = true 34 | let pan = UIPanGestureRecognizer(target: self, action: #selector(self.gestureAction(gesture:))) 35 | colorPickerImageView.addGestureRecognizer(pan) 36 | 37 | let tap = UITapGestureRecognizer(target: self, action: #selector(self.gestureAction(gesture:))) 38 | colorPickerImageView.addGestureRecognizer(tap) 39 | } 40 | } 41 | @IBOutlet weak private var cursorImageView: UIImageView! 42 | 43 | private var radius: CGFloat { 44 | return colorPickerImageView.frame.width/2 45 | } 46 | private var pickerCenter: CGPoint { 47 | return colorPickerImageView.center 48 | } 49 | 50 | override public func draw(_ rect: CGRect) { 51 | displayColor(selectedColor) 52 | } 53 | 54 | // MARK:- Gesture Action 55 | @objc func gestureAction(gesture: UIGestureRecognizer) { 56 | let point = gesture.location(in: colorPickerImageView.superview) 57 | let path = UIBezierPath(ovalIn: colorPickerImageView.frame) 58 | if path.contains(point) { 59 | didSelect(color: calculateColor(point: point)) 60 | } 61 | } 62 | 63 | // MARK:- IBAction 64 | @IBAction private func changedSlider(_ slider: UISlider) { 65 | didSelect(color: calculateColor(point: cursorImageView.center)) 66 | } 67 | 68 | // MARK:- SetColor 69 | private func setSliderColor(color: UIColor) { 70 | let hsba = color.hsba 71 | brightnessSlider.setGradient(startColor: .clear, 72 | endColor: .init(hue: hsba.hue, saturation: hsba.saturation, 73 | brightness: 1.0, alpha: 1.0)) 74 | } 75 | 76 | private func didSelect(color: UIColor) { 77 | selectedColor = color 78 | delegate?.colorPicker(self, didSelect: color) 79 | } 80 | 81 | private func displayColor(_ color: UIColor) { 82 | colorView.backgroundColor = color 83 | cursorImageView.center = calculatePoint(color: color) 84 | 85 | let hsba = color.hsba 86 | let alpha = hsba.alpha * 100 87 | let brightness = hsba.brightness * 100 88 | opacityLabel.text = alpha.colorFormatted 89 | brightnessLabel.text = brightness.colorFormatted 90 | opacitySlider.value = Float(alpha) 91 | brightnessSlider.value = Float(brightness) 92 | 93 | setSliderColor(color: color) 94 | } 95 | 96 | // MARK:- Calculate 97 | private func calculateColor(point: CGPoint) -> UIColor { 98 | // Since the upper side of the screen for obtaining the coordinate difference 99 | // is set as the Y coordinate +, the sign of Y coordinate is replaced 100 | let x = point.x - pickerCenter.x 101 | let y = -(point.y - pickerCenter.y) 102 | 103 | // Find the radian angle 104 | var radian = atan2f(Float(y), Float(x)) 105 | if radian < 0 { 106 | radian += Float(Double.pi*2) 107 | } 108 | 109 | let distance = CGFloat(sqrtf(Float(pow(Double(x), 2) + pow(Double(y), 2)))) 110 | let saturation = (distance > radius) ? 1.0 : distance / radius 111 | let brightness = CGFloat(brightnessSlider.value) / 100.0 112 | let alpha = CGFloat(opacitySlider.value) / 100.0 113 | let hue = CGFloat(radian / Float(Double.pi*2)) 114 | return UIColor(hue: hue, saturation: saturation, brightness: brightness, alpha: alpha) 115 | } 116 | 117 | private func calculatePoint(color: UIColor) -> CGPoint { 118 | let hsba = selectedColor.hsba 119 | let angle = Float(hsba.hue) * Float(Double.pi*2) 120 | let smallRadius = hsba.saturation * radius 121 | let point = CGPoint(x: pickerCenter.x + smallRadius * CGFloat(cosf(angle)), 122 | y: pickerCenter.y + smallRadius * CGFloat(sinf(angle))*(-1)) 123 | return point 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /Source/view/AMColorPickerWheelView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | -------------------------------------------------------------------------------- /Source/view/Cell/AMColorPickerTableViewCell.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AMColorPickerTableViewCell.swift 3 | // AMColorPicker, https://github.com/adventam10/AMColorPicker 4 | // 5 | // Created by am10 on 2018/01/03. 6 | // Copyright © 2018年 am10. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | public struct AMCPCellInfo { 12 | var title: String 13 | var color: UIColor 14 | 15 | public init(title: String, color: UIColor) { 16 | self.title = title 17 | self.color = color 18 | } 19 | 20 | } 21 | 22 | class AMColorPickerTableViewCell: UITableViewCell { 23 | 24 | @IBOutlet weak private var blackView: UIView! 25 | @IBOutlet weak private var titleLabel: UILabel! 26 | @IBOutlet weak private var colorView: UIView! 27 | var info: AMCPCellInfo! { 28 | didSet { 29 | titleLabel.text = info.title 30 | if #available(iOS 11.0, *) { 31 | titleLabel.textColor = UIColor(named: "textColor") 32 | } 33 | colorView.backgroundColor = info.color 34 | } 35 | } 36 | 37 | override func setSelected(_ selected: Bool, animated: Bool) { 38 | super.setSelected(selected, animated: animated) 39 | 40 | // Configure the view for the selected state 41 | if selected { 42 | blackView.backgroundColor = .black 43 | colorView.backgroundColor = info.color 44 | } 45 | } 46 | 47 | override func setHighlighted(_ highlighted: Bool, animated: Bool) { 48 | super.setHighlighted(highlighted, animated: animated) 49 | if highlighted { 50 | blackView.backgroundColor = .black 51 | colorView.backgroundColor = info.color 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Source/view/Cell/AMColorPickerTableViewCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Source/view/Slider/AMColorPickerSlider.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AMColorPickerSlider.swift 3 | // AMColorPicker, https://github.com/adventam10/AMColorPicker 4 | // 5 | // Created by am10 on 2018/01/03. 6 | // Copyright © 2018年 am10. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class AMColorPickerSlider: UISlider { 12 | 13 | @IBInspectable var sliderTopSpace: CGFloat = 0 14 | @IBInspectable var sliderSideSpace: CGFloat = 0 15 | @IBInspectable var sliderColor: UIColor = .clear 16 | 17 | override var bounds: CGRect { 18 | didSet { 19 | drawSlider() 20 | } 21 | } 22 | 23 | private let sliderLayer = CAGradientLayer() 24 | 25 | required init?(coder aDecoder: NSCoder) { 26 | super.init(coder:aDecoder) 27 | initView() 28 | } 29 | 30 | private func initView() { 31 | self.maximumTrackTintColor = .clear 32 | self.minimumTrackTintColor = .clear 33 | 34 | let bundle = Bundle(for: AMColorPickerSlider.self) 35 | if let imagePath = bundle.path(forResource: "AMCP_slider_thumb@2x", ofType: "png") { 36 | setThumbImage(UIImage(contentsOfFile: imagePath), for: .normal) 37 | } 38 | } 39 | 40 | override func draw(_ rect: CGRect) { 41 | drawSlider() 42 | } 43 | 44 | private func drawSlider() { 45 | sliderLayer.removeFromSuperlayer() 46 | 47 | let height = frame.height - sliderTopSpace*2 48 | let width = frame.width - sliderSideSpace*2 49 | 50 | sliderLayer.frame = CGRect(x: sliderSideSpace, y: sliderTopSpace, 51 | width: width, height: height) 52 | sliderLayer.startPoint = CGPoint(x: 0.0, y: 0.5) 53 | sliderLayer.endPoint = CGPoint(x: 1.0, y: 0.5) 54 | sliderLayer.cornerRadius = 5.0 55 | sliderLayer.borderWidth = 2.0 56 | sliderLayer.borderColor = UIColor.gray.cgColor 57 | sliderLayer.backgroundColor = sliderColor.cgColor 58 | layer.insertSublayer(sliderLayer, at: 0) 59 | } 60 | 61 | func setGradient(startColor: UIColor, endColor: UIColor) { 62 | CATransaction.begin() 63 | CATransaction.setValue(kCFBooleanTrue, 64 | forKey: kCATransactionDisableActions) 65 | 66 | sliderLayer.colors = [startColor.cgColor, endColor.cgColor] 67 | CATransaction.commit() 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /logo/favicon-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/logo/favicon-01.png -------------------------------------------------------------------------------- /logo/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /logo/logotype-a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/logo/logotype-a.png -------------------------------------------------------------------------------- /logo/logotype-a.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 50 | 58 | 73 | 85 | 88 | 100 | 108 | 116 | 127 | 142 | 153 | 166 | 175 | 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /logo/logotype-b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adventam10/AMColorPicker/7ecb1c53aefbe7916781a6073b1e4da68d47651b/logo/logotype-b.png -------------------------------------------------------------------------------- /logo/logotype-b.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 50 | 59 | 74 | 86 | 89 | 101 | 110 | 118 | 129 | 144 | 154 | 168 | 177 | 178 | 179 | 180 | 181 | --------------------------------------------------------------------------------