+
+
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)