Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: artman/Signals
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4.0.0
Choose a base ref
...
head repository: artman/Signals
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Oct 20, 2016

  1. Modern operator syntax

    Using the new operator syntax
    gormster committed Oct 20, 2016
    Copy the full SHA
    800c712 View commit details
  2. Linux Compatibility

    Got rid of the ugly __disptch_queue_get_labels in favour of the more
    standard DispatchQueue.getSpecific. Added in `import Dispatch` for
    Linux.
    gormster committed Oct 20, 2016
    Copy the full SHA
    bf95307 View commit details
  3. Swift Package Manager

    Added compatibility for the Swift Package Manager
    gormster committed Oct 20, 2016
    Copy the full SHA
    d8fba58 View commit details
  4. Copy the full SHA
    80982cc View commit details

Commits on Oct 21, 2016

  1. build_linux_main.sh

    Shell file for building LinuxMain.swift. Must be run from a Mac.
    gormster committed Oct 21, 2016
    Copy the full SHA
    4ab31e8 View commit details
  2. Accidentally included debug message in swift file

    Hmm got to make sure we don’t include that in future
    gormster committed Oct 21, 2016
    Copy the full SHA
    e2a494a View commit details
  3. Copy the full SHA
    42cf77a View commit details
  4. Get rid of NSEC_PER_SEC

    gormster committed Oct 21, 2016
    Copy the full SHA
    7f923ee View commit details

Commits on Oct 30, 2016

  1. Merge pull request #42 from gormster/master

    SPM & Linux
    artman authored Oct 30, 2016
    Copy the full SHA
    b3a98cd View commit details

Commits on Nov 1, 2017

  1. Swift4 (#50)

    Migrates to Swift 4
    artman authored Nov 1, 2017
    Copy the full SHA
    0ac8217 View commit details
  2. Update README.md

    artman authored Nov 1, 2017
    Copy the full SHA
    ca4f61c View commit details
  3. Copy the full SHA
    9eef27f View commit details

Commits on Mar 19, 2018

  1. Copy the full SHA
    d9c39d2 View commit details

Commits on Mar 31, 2018

  1. Add Swift Package Manager support (#57)

    * Move UIBarButtonItem into iOS folder
    * Add Swift Package Manager support
    * Add Swift Package Manager instructions to readme
    LinusU authored and artman committed Mar 31, 2018
    Copy the full SHA
    d6bfec3 View commit details

Commits on Apr 2, 2018

  1. Require only App-Extension-Safe API (#58)

    LGTM!
    LinusU authored and artman committed Apr 2, 2018
    Copy the full SHA
    fe177f8 View commit details

Commits on Nov 6, 2018

  1. Swift 4.2 (#64)

    * Swift 4.2
    * Change in pod spec.
    * Update OSX image to Xcode 10.1
    * Update Travis Destinations.
    netizen01 authored and artman committed Nov 6, 2018
    Copy the full SHA
    c69262e View commit details
  2. Bumps podspec and README to 6.0

    Tuomas Artman committed Nov 6, 2018
    Copy the full SHA
    e6266a1 View commit details
  3. Removes faulty code_sign_identity

    Tuomas Artman committed Nov 6, 2018
    Copy the full SHA
    4d804ac View commit details

Commits on Feb 3, 2019

  1. Copy the full SHA
    a807154 View commit details
  2. Fix misspelling in comment block (#69)

    AndrewSB authored and artman committed Feb 3, 2019
    Copy the full SHA
    3bbf81d View commit details
  3. Specify full version in SPM instructions (#70)

    Recent Swift versions require the version specifier in `"from"` to be a full version, otherwise it'll give the following error:
    
    ```text
    error: manifest parse error(s):
    Invalid version string: 6.0
    ```
    LinusU authored and artman committed Feb 3, 2019
    Copy the full SHA
    f35cfe7 View commit details

Commits on Mar 20, 2019

  1. Bump podspec

    artman committed Mar 20, 2019
    Copy the full SHA
    2425a4c View commit details

Commits on Apr 11, 2019

  1. Updated for Swift 5.0 (#76)

    * Updated for Swift 5.0
    
    * Bump version to 6.1.0 since Swfit 5.0 is a breaking change
    
    * Fixed OS version of Apple TV & Watch in travis script
    stephanheilner authored and artman committed Apr 11, 2019
    Copy the full SHA
    e792eb5 View commit details
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -20,4 +20,8 @@ xcuserdata
*.ipa

Pods/
Carthage/Build
Carthage/Build

.build
/.previous-build
.DS_Store
44 changes: 21 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode8
language: swift
osx_image: xcode10.2
env:
global:
- LC_CTYPE=en_US.UTF-8
@@ -9,40 +9,38 @@ env:
- OSX_FRAMEWORK_SCHEME="Signals OSX"
- TVOS_FRAMEWORK_SCHEME="Signals tvOS"
- WATCHOS_FRAMEWORK_SCHEME="Signals watchOS"
- IOS_SDK=iphonesimulator10.0
- OSX_SDK=macosx10.12
- TVOS_SDK=appletvsimulator10.0
- WATCHOS_SDK=watchsimulator3.0


matrix:
- DESTINATION="OS=9.0,name=iPhone 4S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="YES"
- DESTINATION="OS=9.1,name=iPhone 5" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO"
- DESTINATION="OS=9.2,name=iPhone 5S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO"
- DESTINATION="OS=9.3,name=iPhone 6" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO"
- DESTINATION="OS=10.0,name=iPhone 6 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO"
- DESTINATION="OS=10.0,name=iPhone 6S" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO"
- DESTINATION="OS=10.0,name=iPhone 6S Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO"
- DESTINATION="arch=x86_64" SCHEME="$OSX_FRAMEWORK_SCHEME" SDK="$OSX_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=10.0,name=Apple TV 1080p" SCHEME="$TVOS_FRAMEWORK_SCHEME" SDK="$TVOS_SDK" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=3.0,name=Apple Watch - 38mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" SDK="$WATCHOS_SDK" RUN_TESTS="NO" BUILD_EXAMPLE="NO" POD_LINT="NO"
- DESTINATION="OS=8.1,name=iPhone 4S" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=9.1,name=iPhone 5" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=9.3,name=iPhone 6" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=10.1,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=11.4,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="arch=x86_64" SCHEME="$OSX_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=12.2,name=Apple TV 4K" SCHEME="$TVOS_FRAMEWORK_SCHEME" RUN_TESTS="YES" POD_LINT="NO"
- DESTINATION="OS=5.2,name=Apple Watch Series 4 - 44mm" SCHEME="$WATCHOS_FRAMEWORK_SCHEME" RUN_TESTS="NO" POD_LINT="NO"

before_install:
- gem install slather -N
- gem install cocoapods --pre --no-rdoc --no-ri --no-document --quiet
- gem install cocoapods --no-document --quiet

script:
- set -o pipefail
- xcodebuild -version
- xcodebuild -showsdks
- instruments -s devices
- if [ $BUILD == "YES" ]; then
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION" -sdk "$SDK" -configuration Debug ONLY_ACTIVE_ARCH=NO clean build | xcpretty -c;
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION" -sdk "$SDK" -configuration Release ONLY_ACTIVE_ARCH=NO clean build | xcpretty -c;
- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty;
else
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty;
fi

- if [ $RUN_TESTS == "YES" ]; then
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION"
-configuration Debug ONLY_ACTIVE_ARCH=NO GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES clean build test | xcpretty -c;
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty;
else
xcodebuild -project "$PROJECT" -scheme "$SCHEME" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty;
fi

- if [ $POD_LINT == "YES" ]; then
pod lib lint;
fi
14 changes: 14 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// swift-tools-version:4.2
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription

let package = Package(
name: "Signals",
products: [
.library(name: "Signals", targets: ["Signals"]),
],
targets: [
.target(name: "Signals", path: "Signals"),
.testTarget(name: "SignalsTests", dependencies: ["Signals"]),
]
)
36 changes: 23 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ Signals is a library for creating and observing events. It replaces delegates, a
## Requirements

- iOS 7.0 / watchOS 2.0 / Mac OS X 10.9
- Swift 3.0
- Swift 4.2

## Installation

@@ -33,15 +33,25 @@ To integrate Signals into your project add the following to your `Podfile`:
platform :ios, '8.0'
use_frameworks!

pod 'Signals', '~> 4.0'
pod 'Signals', '~> 6.0'
```

#### Carthage

To integrate Signals into your project using Carthage add the following to your `Cartfile`:

```ruby
github "artman/Signals" ~> 4.0
github "artman/Signals" ~> 6.0
```

#### Swift Package Manager

To integrate Signals into your project using SwiftPM add the following to your `Package.swift`:

```swift
dependencies: [
.package(url: "https://github.com/artman/Signals", from: "6.0.0"),
],
```

## Quick start
@@ -70,11 +80,11 @@ Subscribe to these signals from elsewhere in your application
```swift
let networkLoader = NetworkLoader("http://artman.fi")

networkLoader.onProgress.subscribe(on: self) { (progress) in
networkLoader.onProgress.subscribe(with: self) { (progress) in
print("Loading progress: \(progress*100)%")
}

networkLoader.onData.subscribe(on: self) { (data, error) in
networkLoader.onData.subscribe(with: self) { (data, error) in
// Do something with the data
}
```
@@ -86,7 +96,7 @@ Singals aren't restricted to one subscriber. Multiple objects can subscribe to t
You can also subscribe to events after they have occurred:

```swift
networkLoader.onProgress.subscribePast(on: self) { (progress) in
networkLoader.onProgress.subscribePast(with: self) { (progress) in
// This will immediately fire with last progress that was reported
// by the onProgress signal
println("Loading progress: \(progress*100)%")
@@ -98,23 +108,23 @@ networkLoader.onProgress.subscribePast(on: self) { (progress) in
Signal subscriptions can apply filters:

```swift
networkLoader.onProgress.subscribe(on: self) { (progress) in
networkLoader.onProgress.subscribe(with: self) { (progress) in
// This fires when progress is done
}.filter { $0 == 1.0 }
```

You can sample up subscriptions to throttle how often you're subscription is exectuded, regardless how often the `Signal` fires:
You can sample up subscriptions to throttle how often you're subscription is executed, regardless how often the `Signal` fires:

```swift
networkLoader.onProgress.subscribe(on: self) { (progress) in
networkLoader.onProgress.subscribe(with: self) { (progress) in
// Executed once per second while progress changes
}.sample(every: 1.0)
```

By default, a subscription executes synchronously on the thread that fires the `Signal`. To change the default behaviour, you can use the `dispatchOnQueue` method to define the dispatch queue:

```swift
networkLoader.onProgress.subscribe(on: self) { (progress) in
networkLoader.onProgress.subscribe(with: self) { (progress) in
// This fires on the main queue
}.dispatchOnQueue(DispatchQueue.main)
```
@@ -127,7 +137,7 @@ self.onData.fire((data:receivedData, error:receivedError))

// You can use the => operator to fire the signal
self.onData => (data:receivedData, error:receivedError)

// Also works for signals without tuples
self.onProgress => 1.0
```
@@ -138,12 +148,12 @@ Signals extends all classes that extend from UIControl (not available on OS X) a

```swift
let button = UIButton()
button.onTouchUpInside.observe(on: self) {
button.onTouchUpInside.observe(with: self) {
// Handle the touch
}

let slider = UISlider()
slider.onValueChanged.observe(on: self) {
slider.onValueChanged.observe(with: self) {
// Handle value change
}
```
8 changes: 4 additions & 4 deletions Signals.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Signals'
s.version = '4.0.0'
s.version = '6.1.0'
s.license = 'MIT'
s.summary = 'Elegant eventing'
s.homepage = 'https://github.com/artman/Signals'
@@ -9,13 +9,13 @@ Pod::Spec.new do |s|
s.source = { :git => 'https://github.com/artman/Signals.git', :tag => s.version }

s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
s.tvos.deployment_target = '9.0'
s.watchos.deployment_target = '2.0'
s.osx.deployment_target = '10.11'

s.source_files = 'Signals/Signal.swift'
s.ios.source_files = 'Signals/iOS/*.swift'
s.tvos.source_files = 'Signals/iOS/*.swift'

s.requires_arc = true
s.swift_version = '5.0'
end
Loading