Skip to content

Commit

Permalink
Merge pull request #16 from WallabyStuff/develop
Browse files Browse the repository at this point in the history
Version 0.1.2
  • Loading branch information
WallabyStuff authored Mar 7, 2023
2 parents 804888d + 7eebf03 commit d2272d0
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 58 deletions.
6 changes: 3 additions & 3 deletions Example/RadioColorPicker/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LQu-Zn-E6b" customClass="RadioColorPicker" customModule="RadioColorPicker">
<rect key="frame" x="16" y="117.33333333333333" width="361" height="214.66666666666669"/>
<rect key="frame" x="16" y="117.33333333333333" width="362" height="214.66666666666669"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3Ex-QD-BD5">
Expand Down Expand Up @@ -221,9 +221,9 @@
<constraint firstAttribute="bottom" secondItem="3Ex-QD-BD5" secondAttribute="bottom" id="8UB-fW-R94"/>
<constraint firstItem="DKM-wR-ehm" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" id="MPk-Ky-S60"/>
<constraint firstAttribute="trailing" secondItem="3Ex-QD-BD5" secondAttribute="trailing" id="NjL-mn-0Sm"/>
<constraint firstAttribute="trailingMargin" secondItem="LQu-Zn-E6b" secondAttribute="trailing" id="QaY-bl-yiJ"/>
<constraint firstItem="LQu-Zn-E6b" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leadingMargin" id="U06-sx-kop"/>
<constraint firstItem="DKM-wR-ehm" firstAttribute="top" secondItem="jyV-Pf-zRb" secondAttribute="bottom" id="Vpe-tG-sXm"/>
<constraint firstAttribute="trailing" secondItem="LQu-Zn-E6b" secondAttribute="trailing" constant="15" id="W2j-YQ-5Qj"/>
<constraint firstItem="3Ex-QD-BD5" firstAttribute="leading" secondItem="kh9-bI-dsS" secondAttribute="leading" id="qa9-23-aJa"/>
<constraint firstItem="LQu-Zn-E6b" firstAttribute="top" secondItem="DKM-wR-ehm" secondAttribute="bottom" id="qwE-RD-3So"/>
<constraint firstItem="3Ex-QD-BD5" firstAttribute="top" secondItem="LQu-Zn-E6b" secondAttribute="bottom" id="z5R-Dw-gU0"/>
Expand All @@ -244,7 +244,7 @@
</scenes>
<designables>
<designable name="LQu-Zn-E6b">
<size key="intrinsicContentSize" width="-8" height="36"/>
<size key="intrinsicContentSize" width="0.0" height="36"/>
</designable>
</designables>
<resources>
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion Example/RadioColorPicker/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# RadioColorPicker
<div align="center">
<img src="https://user-images.githubusercontent.com/63496607/215957086-5882c876-b827-4e5e-af8d-2ecc0c673876.png" width="100">
<h1>RadioColorPicker</h1>

[![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)
</div>

[![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)
</br>

## Example

Expand Down
2 changes: 1 addition & 1 deletion RadioColorPicker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
16 changes: 14 additions & 2 deletions Sources/RadioColorPicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -147,14 +147,26 @@ 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))
let group = NSCollectionLayoutGroup.horizontal(
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)
Expand Down

0 comments on commit d2272d0

Please sign in to comment.