Skip to content

Commit

Permalink
Bumped to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Knabel committed Aug 22, 2016
1 parent 605c120 commit 584363e
Show file tree
Hide file tree
Showing 70 changed files with 7,066 additions and 765 deletions.
28 changes: 14 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# Mac
.DS_Store
._*

# Xcode
#
## Build generated
.build/
build/
DerivedData

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
Expand All @@ -10,20 +18,12 @@ build/
*.perspectivev3
!default.perspectivev3
xcuserdata

## Other
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
*.xcscmblueprint

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
#
Pods/

# Bug
._*
## Docs
# docs/
9 changes: 9 additions & 0 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
author: Valentin Knabel
author_url: https://twitter.com/vknabel
github_url: https://github.com/vknabel/Finite
module: Finite
module_version: 2.0.0
root_url: https://vknabel.github.io/Finite/
readme: README.md
output: docs/
theme: fullwidth
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
swift-2.1.1
3.0
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 2.0.0
*Released: 2016-08-22*

**Breaking Changes:**

- Renamed Project from `StateMachine` to `Finite` - @vknabel
- Renamed `StateMachine.triggerTransition(to:)` to `StateMachine.transition(to:)` - @vknabel
- `StateMachine.transition(to:)` throws `TransitionError` and rethrows - @vknabel

**API Additions:**

- `Operation`s may now throw - @vknabel
- Added `TransitionError` - @vknabel
- Added Swift 3.0 Support - @vknabel
- Added generated Docs - @vknabel

**Other Changes:**

- Added `CocoaPods` and `Swift Package Manager` support - @vknabel
- Started this `CHANGELOG`.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playground version='3.0' sdk='iphonesimulator'>
<playground version='3.0' sdk='macosx'>
<sections>
<code source-file-name='section-1.swift'/>
</sections>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Playground - noun: a place where people can play

import StateMachine
import Finite

enum Test: Int {
case Saving, Fetching, Deleting
Expand All @@ -13,16 +13,16 @@ var machine = StateMachine<Test>(initial: .Ready) { c in
}

machine.onTransitions(from: .Ready) {
println("From Ready: show activity indicator")
print("From Ready: show activity indicator")
}
machine.onTransitions(to: .Ready) {
println("To Ready: hide activity indicator")
print("To Ready: hide activity indicator")
}
machine.onTransitions(to: .Saving) {
println("To: save")
print("To: save")
}
machine.triggerTransition(to: .Saving) {
println("Triggered: save")
try machine.transition(to: .Saving) {
print("Triggered: save")
}

machine.state.rawValue
Expand All @@ -37,7 +37,7 @@ enum State<T: Hashable>: Hashable {
switch self {
case .Ready:
return 0
case Error:
case .Error:
return 1
case let .Busy(b):
return 2 + b.hashValue
Expand Down Expand Up @@ -71,13 +71,13 @@ enum Process {
case Saving, Fetching, Deleting
}

var scnd = StateMachine<State<Process>>(initial: .Ready) { (inout c: StateFlow<State<Process>>) in
var scnd = StateMachine<State<Process>>(initial: .Ready) { flow in
//allow transitions from busy
c.allow(to: [.Ready, .Error]) { transition in
flow.allow(to: [.Ready, .Error]) { transition in
return transition.from?.isBusy ?? false
}
//allow transitions from ready to busy
c.allow(from: .Ready) { t in
flow.allow(from: .Ready) { t in
return t.to?.isBusy ?? false
}
}
Expand Down
18 changes: 18 additions & 0 deletions Finite.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Pod::Spec.new do |s|
s.name = 'Finite'
s.version = '2.0.0'
s.summary = 'A simple state machine written in Swift.'
s.description = <<-DESC
Finite is a simple, pure Swift finite state machine.
DESC
s.social_media_url = "https://twitter.com/vknabel"
s.homepage = 'https://github.com/vknabel/Finite'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Valentin Knabel' => 'develop@vknabel.com' }
s.source = { :git => 'https://github.com/vknabel/Finite.git', :tag => s.version.to_s }
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
s.watchos.deployment_target = "2.0"
s.tvos.deployment_target = "9.0"
s.source_files = 'Sources/*.swift'
end
7 changes: 7 additions & 0 deletions Finite.xcodeproj/Configs/Project.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PRODUCT_NAME = $(TARGET_NAME)
SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator
MACOSX_DEPLOYMENT_TARGET = 10.10
DYLIB_INSTALL_NAME_BASE = @rpath
OTHER_SWIFT_FLAGS = -DXcode
COMBINE_HIDPI_IMAGES = YES
USE_HEADERMAP = NO
25 changes: 25 additions & 0 deletions Finite.xcodeproj/FiniteTests_Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
25 changes: 25 additions & 0 deletions Finite.xcodeproj/Finite_Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
Loading

0 comments on commit 584363e

Please sign in to comment.