diff --git a/Example/RadioColorPicker/Base.lproj/Main.storyboard b/Example/RadioColorPicker/Base.lproj/Main.storyboard index 4a0c28c..c8b68a1 100644 --- a/Example/RadioColorPicker/Base.lproj/Main.storyboard +++ b/Example/RadioColorPicker/Base.lproj/Main.storyboard @@ -21,7 +21,7 @@ - + @@ -221,9 +221,9 @@ - + @@ -244,7 +244,7 @@ - + diff --git a/Example/RadioColorPicker/Images.xcassets/AppIcon.appiconset/Contents.json b/Example/RadioColorPicker/Images.xcassets/AppIcon.appiconset/Contents.json index 7006c9e..2049132 100644 --- a/Example/RadioColorPicker/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Example/RadioColorPicker/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,53 +1,14 @@ { "images" : [ { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "2x" - }, - { - "idiom" : "iphone", - "size" : "60x60", - "scale" : "3x" - }, - { - "idiom" : "ios-marketing", - "size" : "1024x1024", - "scale" : "1x" + "filename" : "RadioColorPickerIcon.png", + "idiom" : "universal", + "platform" : "ios", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } } diff --git a/Example/RadioColorPicker/Images.xcassets/AppIcon.appiconset/RadioColorPickerIcon.png b/Example/RadioColorPicker/Images.xcassets/AppIcon.appiconset/RadioColorPickerIcon.png new file mode 100644 index 0000000..47ef113 Binary files /dev/null and b/Example/RadioColorPicker/Images.xcassets/AppIcon.appiconset/RadioColorPickerIcon.png differ diff --git a/Example/RadioColorPicker/ViewController.swift b/Example/RadioColorPicker/ViewController.swift index 3bc760a..84463b8 100644 --- a/Example/RadioColorPicker/ViewController.swift +++ b/Example/RadioColorPicker/ViewController.swift @@ -67,7 +67,6 @@ class ViewController: UIViewController { radioColorPicker.addColor(.systemGreen) radioColorPicker.addColor(.systemBlue) radioColorPicker.addColor(.systemPurple) - radioColorPicker.contentInset = .init(top: 20, leading: 24, bottom: 20, trailing: 24) radioColorPicker.delegate = self } diff --git a/README.md b/README.md index 49776d3..af431e4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,15 @@ -# RadioColorPicker +
+ +

RadioColorPicker

+ + [![CI Status](https://img.shields.io/travis/SunneyG/RadioColorPicker.svg?style=flat)](https://travis-ci.org/SunneyG/RadioColorPicker) + [![Version](https://img.shields.io/cocoapods/v/RadioColorPicker.svg?style=flat)](https://cocoapods.org/pods/RadioColorPicker) + [![License](https://img.shields.io/cocoapods/l/RadioColorPicker.svg?style=flat)](https://cocoapods.org/pods/RadioColorPicker) + [![Platform](https://img.shields.io/cocoapods/p/RadioColorPicker.svg?style=flat)](https://cocoapods.org/pods/RadioColorPicker) + ![SwiftPM](https://img.shields.io/badge/SPM-supported-DE5C43.svg?style=flat) +
-[![CI Status](https://img.shields.io/travis/SunneyG/RadioColorPicker.svg?style=flat)](https://travis-ci.org/SunneyG/RadioColorPicker) -[![Version](https://img.shields.io/cocoapods/v/RadioColorPicker.svg?style=flat)](https://cocoapods.org/pods/RadioColorPicker) -[![License](https://img.shields.io/cocoapods/l/RadioColorPicker.svg?style=flat)](https://cocoapods.org/pods/RadioColorPicker) -[![Platform](https://img.shields.io/cocoapods/p/RadioColorPicker.svg?style=flat)](https://cocoapods.org/pods/RadioColorPicker) -![SwiftPM](https://img.shields.io/badge/SPM-supported-DE5C43.svg?style=flat) +
## Example diff --git a/RadioColorPicker.podspec b/RadioColorPicker.podspec index 5c7338e..5f533e8 100644 --- a/RadioColorPicker.podspec +++ b/RadioColorPicker.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'RadioColorPicker' - s.version = '0.1.1' + s.version = '0.1.2' s.summary = '사용하기 쉽고 알잘딱 할 줄 아는 ColorPicker' s.swift_versions = '5.0' diff --git a/Sources/RadioColorPicker.swift b/Sources/RadioColorPicker.swift index 20ef324..3f338b2 100644 --- a/Sources/RadioColorPicker.swift +++ b/Sources/RadioColorPicker.swift @@ -102,7 +102,7 @@ open class RadioColorPicker: UIView { } } open override var intrinsicContentSize: CGSize { - let width = CGFloat(colors.count) * pickerSize + contentInset.leading + contentInset.trailing + CGFloat(colors.count - 1) * horizontalSpacing + let width = CGFloat(colors.count) * pickerSize + contentInset.leading + contentInset.trailing + CGFloat(colors.count) * horizontalSpacing let height = pickerSize + contentInset.top + contentInset.bottom return .init(width: width, height: height) } @@ -147,7 +147,7 @@ open class RadioColorPicker: UIView { let item = NSCollectionLayoutItem(layoutSize: itemSize) // Group - let widthDimension: NSCollectionLayoutDimension = scrollDirection == .vertical ? .fractionalWidth(1) : .absolute(pickerSize + horizontalSpacing) + let widthDimension: NSCollectionLayoutDimension = scrollDirection == .vertical ? .fractionalWidth(1) : .absolute(pickerSize) let groupSize = NSCollectionLayoutSize( widthDimension: widthDimension, heightDimension: .absolute(pickerSize)) @@ -155,6 +155,18 @@ open class RadioColorPicker: UIView { layoutSize: groupSize, subitems: [item]) group.interItemSpacing = scrollDirection == .vertical ? .flexible(horizontalSpacing) : .fixed(horizontalSpacing) + group.edgeSpacing = scrollDirection == .vertical ? + .init( + leading: .flexible(horizontalSpacing / 2), + top: .fixed(0), + trailing: .flexible(horizontalSpacing / 2), + bottom: .fixed(0)) + : + .init( + leading: .fixed(horizontalSpacing / 2), + top: .fixed(0), + trailing: .fixed(horizontalSpacing / 2), + bottom: .fixed(0)) // Section let section = NSCollectionLayoutSection(group: group)