Skip to content

Commit

Permalink
Merge pull request #8 from Ben-G/benji/release-2.0.0
Browse files Browse the repository at this point in the history
Prepare 2.0.0 Release
  • Loading branch information
Ben-G committed Mar 3, 2016
2 parents 6aee149 + e7c1eee commit 28ab681
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 24 deletions.
22 changes: 22 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#2.0
*Released: 03/02/2016*

**Breaking API Changes:**

- Removed `Validated2` and `Validated3` in favor of introduced logical wrapper validators - @Ben-G on suggestion of @tomquist
- Failable initializer of `Validated` now requires explicit `value` argument due to introduction of throwing initializer - @Ben-G

**API Additions:**

- Added wrapper validators for logical operators - @tomquist
- Added throwing initializer for `Validated` - @Ben-G upon suggestion of @radex

**Other Changes:**

- Major Refactoring of `Validated` Type - @dehesa
- Addition of OSX, tvOS and watchOS targets - @dehesae

#1.0
*Released: 02/24/2016*

- Initial Release - @Ben-G
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,23 @@ Note, that it is not required to provide a typealias, but for most cases it is r

**And that's it!**

`LoggedInUser` now has a failable initializer that takes a `User`. If the passed in `User` fulfills the logged-in requirement you will have a `LoggedInUser`, otherwise `nil`.
`LoggedInUser` now has a failable initializer that takes a `User`. If the passed in `User` fulfills the logged-in requirement you will have a `LoggedInUser`, otherwise `nil`. Additionally `LoggedInUser` provides a throwing initializer, in case you prefer to handle failed validations as errors instead of `nil` values.

The underlying value (the full `User` value) is stored in the `.value` property of `LoggedInUser`.

##Beyond the Basics

Validated provides two further features that might be non-obvious.
Validated provides some further features that might be non-obvious.

###Validated2, Validated3
###Composing Validators with Logical Operators

Using `Validated2` or `Validated3` you can create a new type that has two or three requirements, respectively. All requirements need to be verified successfully in order for the type to initialize:
Validated offers `Validator` types for logical operations that allow you to require multiple validations in different combinations. E.g. you can use the `And` validator to require that two requirements must be met for your type to intializer:

```swift
typealias AllCapsNonEmptyString =
Validated2<String, NonEmptyStringValidator, AllCapsLatinStringValidator>
Validated<String, And<NonEmptyStringValidator, AllCapsLatinStringValidator>>
```
`Or` and `Not` are provided as additional validators. You can take a look at the specs for additional examples.

###Generic Validators

Expand Down Expand Up @@ -138,7 +139,7 @@ And run `pod install`.

## Carthage

You can install Validated via [Carthage]() by adding the following line to your Cartfile:
You can install Validated via Carthage by adding the following line to your Cartfile:

github "Ben-G/Validated"

Expand Down
8 changes: 0 additions & 8 deletions Tests/ValidatedTests.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// ValidatedTests.swift
// ValidatedTests
//
// Created by Benji Encz on 2/24/16.
// Copyright © 2016 Benjamin Encz. All rights reserved.
//

import XCTest
import Validated

Expand Down
2 changes: 1 addition & 1 deletion Validated.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Validated"
s.version = "1.0.0"
s.version = "2.0.0"
s.summary = "A Swift μ-Library for Somewhat Dependent Types"
s.description = <<-DESC
Validated is a μ-library (~50 Source Lines of Code) that allows you make better use of Swift's type system
Expand Down
6 changes: 0 additions & 6 deletions Validated/Validated.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
// Validated.swift
// Validated
//
// Created by Benji Encz on 2/24/16.
// Copyright © 2016 Benjamin Encz. All rights reserved.

/// This protocol needs to be implemented in order to add a requirement to
/// a wrapped type.
/// Implementers receive the wrapped type and need to determine if its values
Expand Down
6 changes: 3 additions & 3 deletions Validated/configuration/common.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ PRODUCT_BUNDLE_IDENTIFIER = de.benjamin-encz.Validated
INFOPLIST_FILE = $(SRCROOT)/Validated/configuration/info.plist

// Versioning
CURRENT_PROJECT_VERSION = 1
DYLIB_CURRENT_VERSION = 1.0.1
CURRENT_PROJECT_VERSION = 2
DYLIB_CURRENT_VERSION = 2.0.0
DYLIB_COMPATIBILITY_VERSION = $(DYLIB_CURRENT_VERSION)

// APPLE LLVM - Language
GCC_C_LANGUAGE_STANDARD = c11
CLANG_ENABLE_MODULES = YES

// User-defined
FRAMEWORK_LICENSE = Copyright © 2016 Ben Encz. MIT License.
FRAMEWORK_LICENSE = Copyright © 2016 Benjamin Encz. MIT License.
BUNDLE_SIGNATURE = BENC

0 comments on commit 28ab681

Please sign in to comment.