Skip to content

Commit

Permalink
Merge branch 'release/1.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrwendt committed Apr 18, 2020
2 parents d7e4e5e + 978c0c7 commit 7984ce8
Show file tree
Hide file tree
Showing 87 changed files with 1,033 additions and 427 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
## Version 1.2.0
### Features
* [Hex color input field](https://github.com/chrs1885/SheetyColors/issues/15)

## Version 1.1.0
### Features
* SwiftUI support
* Expose SheetyColors view]
* [Expose SheetyColors view](https://github.com/chrs1885/SheetyColors/issues/13)

## Version 1.0.2
### Enhancements
*[Support Swift Package Manager](https://github.com/chrs1885/SheetyColors/issues/10)
* [Support Swift Package Manager](https://github.com/chrs1885/SheetyColors/issues/10)

## Version 1.0.1
### Bugfix
Expand Down
13 changes: 9 additions & 4 deletions Documentation/Reference/README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# Reference Documentation
This Reference Documentation has been generated with
[SourceDocs](https://github.com/eneko/SourceDocs).

## Protocols

- [SheetyColorProtocol](protocols/SheetyColorProtocol.md)
- [SheetyColorsConfigProtocol](protocols/SheetyColorsConfigProtocol.md)
- [SheetyColorsDelegate](protocols/SheetyColorsDelegate.md)

## Structs

- [SheetyColorsConfig](structs/SheetyColorsConfig.md)
- [SheetyColorsView](structs/SheetyColorsView.md)
- [SheetyColorsViewFactory](structs/SheetyColorsViewFactory.md)

## Classes

- [Coordinator](classes/Coordinator.md)
- [GrayscaleColor](classes/GrayscaleColor.md)
- [HSBAColor](classes/HSBAColor.md)
- [RGBAColor](classes/RGBAColor.md)
- [SheetyColorsViewController](classes/SheetyColorsViewController.md)

## Enums

Expand All @@ -28,3 +29,7 @@ This Reference Documentation has been generated with
- [RGBAColor](extensions/RGBAColor.md)
- [SheetyColorsController](extensions/SheetyColorsController.md)
- [UIColor](extensions/UIColor.md)

# Reference Documentation
This reference documentation was generated with
[SourceDocs](https://github.com/eneko/SourceDocs).
14 changes: 14 additions & 0 deletions Documentation/Reference/classes/Coordinator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
**CLASS**

# `Coordinator`

```swift
public class Coordinator: NSObject, SheetyColorsDelegate
```

## Methods
### `didSelectColor(_:)`

```swift
public func didSelectColor(_ color: UIColor)
```
8 changes: 4 additions & 4 deletions Documentation/Reference/classes/RGBAColor.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public init(red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat)
> Creates a RGBAColor instance.
>
> - Parameter:
> - red: The red component.
> - green: The green component.
> - blue: The blue component.
> - alpha: The opacity component.
> - red: The red component.
> - green: The green component.
> - blue: The blue component.
> - alpha: The opacity component.

### `copy(with:)`

Expand Down
16 changes: 16 additions & 0 deletions Documentation/Reference/classes/SheetyColorsViewController.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
**CLASS**

# `SheetyColorsViewController`

```swift
public class SheetyColorsViewController: UIViewController, SheetyColorsViewControllerProtocol
```

> The controller class managing a SheetyColors view.

## Methods
### `viewDidLoad()`

```swift
public override func viewDidLoad()
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ convenience init(withConfig config: SheetyColorsConfigProtocol)
> Creates a SheetyColorsController instance.
>
> - Parameter:
> - config: A config object containing options for specifying the look and feel of a SheetyColors view.
> - config: A config object containing options for specifying the look and feel of a SheetyColors view.
7 changes: 7 additions & 0 deletions Documentation/Reference/extensions/UIColor.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ var rgbaColor: RGBAColor
```

> The RGBAColor representation of the UIColor instance.
## Methods
### `init(hex:)`

```swift
public convenience init?(hex: String)
```
2 changes: 1 addition & 1 deletion Documentation/Reference/protocols/SheetyColorProtocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public protocol SheetyColorProtocol: Codable
```

> A protocol defining a color object provided by the SheetyColors view..
> A protocol defining a color object provided by the SheetyColors view.

## Properties
### `uiColor`
Expand Down
21 changes: 21 additions & 0 deletions Documentation/Reference/protocols/SheetyColorsDelegate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
**PROTOCOL**

# `SheetyColorsDelegate`

```swift
public protocol SheetyColorsDelegate: AnyObject
```

> A protocol defining functions that are called when interacting with a color picker.

## Methods
### `didSelectColor(_:)`

```swift
func didSelectColor(_ color: UIColor)
```

> A delegate function that gets called once any slider value has been changed.
>
> - Parameter:
> - color: The updated color.
26 changes: 26 additions & 0 deletions Documentation/Reference/structs/SheetyColorsView.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
**STRUCT**

# `SheetyColorsView`

```swift
public struct SheetyColorsView: UIViewControllerRepresentable
```

## Methods
### `makeCoordinator()`

```swift
public func makeCoordinator() -> Coordinator
```

### `makeUIViewController(context:)`

```swift
public func makeUIViewController(context: UIViewControllerRepresentableContext<SheetyColorsView>) -> SheetyColorsViewController
```

### `updateUIViewController(_:context:)`

```swift
public func updateUIViewController(_: SheetyColorsViewController, context _: UIViewControllerRepresentableContext<SheetyColorsView>)
```
24 changes: 24 additions & 0 deletions Documentation/Reference/structs/SheetyColorsViewFactory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
**STRUCT**

# `SheetyColorsViewFactory`

```swift
public struct SheetyColorsViewFactory
```

> A factory for creating SheetyColors view controller

## Methods
### `createView(withConfig:delegate:)`

```swift
public static func createView(withConfig config: SheetyColorsConfigProtocol, delegate: SheetyColorsDelegate? = nil) -> SheetyColorsViewController
```

> Creates a SheetyColorsViewController instance based on a given configuration.
>
> - Parameter:
> - config: Defines all aspects of the view such as a color model type, alpha value support, texts, initial colors, or haptical feedback.
> - delegate: A delegate used for handling the color selection. A delegate needs to be provided in cases where you want to use the SheetyColorsViewController directly and not as part of a UIAlertViewController (e.g. SwiftUI).
>
> - Returns: A SheetyColorsViewController instance.
Binary file modified Documentation/demo_customizable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/demo_dark_mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Documentation/demo_minimum_configuration.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation/hex_input.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions Example/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PODS:
- Capable/Colors (1.1.4)
- Nimble (8.0.7)
- Quick (2.2.0)
- SheetyColors (1.1.0):
- SheetyColors (1.2.0):
- Capable/Colors (~> 1.1)
- SnapshotTesting (1.7.2)

Expand All @@ -27,9 +27,9 @@ SPEC CHECKSUMS:
Capable: 9f420f2a80a12144814ea2f0ba196516a0827ca1
Nimble: a73af6ecd4c9106f434f3d55fc54570be3739e0b
Quick: 7fb19e13be07b5dfb3b90d4f9824c855a11af40e
SheetyColors: 8503d13ddcce9517906732ecda0193ba09ad5ee2
SheetyColors: 8dc64a666415be8a81df3c5d44b9088d6f8bee2e
SnapshotTesting: 8caa6661fea7c8019d5b46de77c16bab99c36c5c

PODFILE CHECKSUM: 5095640969646fd5f5546f91228d960c22a55514

COCOAPODS: 1.8.4
COCOAPODS: 1.9.1
32 changes: 32 additions & 0 deletions Example/SheetyColors.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@

/* Begin PBXBuildFile section */
22AA8832D7526E840D7FA916 /* Pods_SheetyColors_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87B5CDD8C9040B059B8C1536 /* Pods_SheetyColors_Example.framework */; };
443A8A252447636500487BAD /* HapticFeedbackProviderMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 443A8A242447636500487BAD /* HapticFeedbackProviderMock.swift */; };
44B496B12233C0AB00CF8B38 /* ColorCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44B496B02233C0AB00CF8B38 /* ColorCell.swift */; };
44D0F1F4243148E7001DF988 /* SheetyColorsDelegateMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44D0F1F3243148E7001DF988 /* SheetyColorsDelegateMock.swift */; };
44D9423224445C81000B7F31 /* HexTextFieldTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44D9423124445C81000B7F31 /* HexTextFieldTests.swift */; };
44D942352444C436000B7F31 /* UIColor+hexTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44D942342444C436000B7F31 /* UIColor+hexTests.swift */; };
44D942382444DA08000B7F31 /* HexTextFieldDelegateMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44D942372444DA08000B7F31 /* HexTextFieldDelegateMock.swift */; };
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
607FACD81AFB9204008FA782 /* ColorsCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ColorsCollectionViewController.swift */; };
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
Expand Down Expand Up @@ -53,8 +57,12 @@
0E199A98F8761686DD180A4E /* SheetyColors.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = SheetyColors.podspec; path = ../SheetyColors.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
1BB8CE96911C8C57D7DDDF3A /* Pods_SheetyColors_Tests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_SheetyColors_Tests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3697BB2765259F63B9A5841A /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
443A8A242447636500487BAD /* HapticFeedbackProviderMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HapticFeedbackProviderMock.swift; sourceTree = "<group>"; };
44B496B02233C0AB00CF8B38 /* ColorCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorCell.swift; sourceTree = "<group>"; };
44D0F1F3243148E7001DF988 /* SheetyColorsDelegateMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SheetyColorsDelegateMock.swift; sourceTree = "<group>"; };
44D9423124445C81000B7F31 /* HexTextFieldTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexTextFieldTests.swift; sourceTree = "<group>"; };
44D942342444C436000B7F31 /* UIColor+hexTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+hexTests.swift"; sourceTree = "<group>"; };
44D942372444DA08000B7F31 /* HexTextFieldDelegateMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexTextFieldDelegateMock.swift; sourceTree = "<group>"; };
553AD8A7258AE141F7908ED0 /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
607FACD01AFB9204008FA782 /* SheetyColors_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SheetyColors_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -139,6 +147,23 @@
name = Views;
sourceTree = "<group>";
};
44D942332444C41D000B7F31 /* Extensions */ = {
isa = PBXGroup;
children = (
44D942342444C436000B7F31 /* UIColor+hexTests.swift */,
);
name = Extensions;
sourceTree = "<group>";
};
44D942362444D9BC000B7F31 /* Mocks */ = {
isa = PBXGroup;
children = (
44D942372444DA08000B7F31 /* HexTextFieldDelegateMock.swift */,
443A8A242447636500487BAD /* HapticFeedbackProviderMock.swift */,
);
name = Mocks;
sourceTree = "<group>";
};
607FACC71AFB9204008FA782 = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -217,9 +242,11 @@
83205EE22256812D00D62BB8 /* Views */ = {
isa = PBXGroup;
children = (
44D942362444D9BC000B7F31 /* Mocks */,
83205EE32256813800D62BB8 /* Extensions */,
831FCF01225E62F8003C48A4 /* SheetyColorsViewTests.swift */,
83DDE21B2262204F005F4CEF /* GradientSliderTests.swift */,
44D9423124445C81000B7F31 /* HexTextFieldTests.swift */,
);
name = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -365,6 +392,7 @@
83DDE21F2264FD06005F4CEF /* Models */ = {
isa = PBXGroup;
children = (
44D942332444C41D000B7F31 /* Extensions */,
83DDE2202264FD1C005F4CEF /* SheetyColorsConfigTests.swift */,
);
name = Models;
Expand Down Expand Up @@ -628,6 +656,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
44D942382444DA08000B7F31 /* HexTextFieldDelegateMock.swift in Sources */,
832DCEFF226E4D7C00DAF3EF /* HSBViewModelTests.swift in Sources */,
832DCF03226F92E100DAF3EF /* UIColor+hsbaColorTests.swift in Sources */,
834A36E52249829300DECD37 /* SheetyColorsConfigMock.swift in Sources */,
Expand All @@ -636,13 +665,16 @@
83DDE21C2262204F005F4CEF /* GradientSliderTests.swift in Sources */,
834A36F2224E94FC00DECD37 /* SheetyColorsViewModelMock.swift in Sources */,
834A36E2224971F700DECD37 /* SheetyColorsViewFactoryTests.swift in Sources */,
44D942352444C436000B7F31 /* UIColor+hexTests.swift in Sources */,
831FCF0022591DFE003C48A4 /* UIAlertController+customViewTests.swift in Sources */,
831FCF02225E62F8003C48A4 /* SheetyColorsViewTests.swift in Sources */,
836D683D22F8B4C5005452FB /* AppearenceProviderMock.swift in Sources */,
44D0F1F4243148E7001DF988 /* SheetyColorsDelegateMock.swift in Sources */,
83537FC52273A01000E91C39 /* GrayscaleViewModel.swift in Sources */,
443A8A252447636500487BAD /* HapticFeedbackProviderMock.swift in Sources */,
83537FC222739E1400E91C39 /* UIColor+grayscaleColorTests.swift in Sources */,
834A36E8224E88F400DECD37 /* RGBViewModelTests.swift in Sources */,
44D9423224445C81000B7F31 /* HexTextFieldTests.swift in Sources */,
834A36ED224E8C7400DECD37 /* SheetyColorsViewDelegateMock.swift in Sources */,
834A36F4224E98F900DECD37 /* SheetyColorsViewMock.swift in Sources */,
);
Expand Down
7 changes: 3 additions & 4 deletions Example/Tests/GradientSliderTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class GradientSliderTests: QuickSpec {
context("when initialized with default values") {
it("renders the slider control") {
let view = creatContainerView(withView: sut)
assertSnapshot(matching: view, as: .image(size: .init(width: testFrame.width, height: testFrame.height)))
assertSnapshot(matching: sut, as: .recursiveDescription(size: .init(width: testFrame.width, height: testFrame.height)))
assertSnapshot(matching: view, as: .image(size: .init(width: testFrame.width, height: testFrame.height)), named: "initial_default_state")
}
}

Expand All @@ -45,14 +44,14 @@ class GradientSliderTests: QuickSpec {
}
it("renders the slider control") {
let view = creatContainerView(withView: sut)
assertSnapshot(matching: view, as: .image(size: .init(width: testFrame.width, height: testFrame.height)))
assertSnapshot(matching: view, as: .image(size: .init(width: testFrame.width, height: testFrame.height)), named: "initial_custom_state")
}
}
}
}
}

func creatContainerView(withView view: UIView) -> UIView {
private func creatContainerView(withView view: UIView) -> UIView {
let container = UIView()
container.addSubview(view)
view.anchor(top: container.topAnchor, bottom: container.bottomAnchor, left: container.leftAnchor, right: container.rightAnchor)
Expand Down
12 changes: 4 additions & 8 deletions Example/Tests/GrayscaleViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,20 @@ class GrayscaleViewModelTests: QuickSpec {
var delegateMock: SheetyColorsDelegateMock!

context("after initialization") {
var testColorModel: GrayscaleColor!
var testIsAlphaEnabled: Bool!
var testHasTextOrMessage: Bool!
let testColorModel = GrayscaleColor(white: 120.0, alpha: 69.0)
let testConfig = SheetyColorsConfig(alphaEnabled: true, hapticFeedbackEnabled: true, initialColor: testColorModel.uiColor, title: "title", message: "message", type: .grayscale)

beforeEach {
viewDelegateMock = SheetyColorsViewDelegateMock()
delegateMock = SheetyColorsDelegateMock()
testIsAlphaEnabled = true
testHasTextOrMessage = true
testColorModel = GrayscaleColor(white: 123.0, alpha: 69.0)
sut = GrayscaleViewModel(withColorModel: testColorModel, isAlphaEnabled: testIsAlphaEnabled, hasTextOrMessage: testHasTextOrMessage)
sut = GrayscaleViewModel(withConfig: testConfig)
sut.viewDelegate = viewDelegateMock
sut.delegate = delegateMock
}

context("when calling hasTextOrMessage property") {
it("returns the correct state") {
expect(sut!.hasTextOrMessage).to(equal(testHasTextOrMessage))
expect(sut!.hasTextOrMessage).to(beTrue())
}
}

Expand Down
Loading

0 comments on commit 7984ce8

Please sign in to comment.