-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ae0d182
commit 96176e4
Showing
6 changed files
with
113 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "ReactiveKit" | ||
s.version = "3.14.0" | ||
s.version = "3.14.1" | ||
s.summary = "A Swift Reactive Programming Framework" | ||
s.description = "ReactiveKit is a Swift framework for reactive and functional reactive programming." | ||
s.homepage = "https://github.com/DeclarativeHub/ReactiveKit" | ||
s.license = 'MIT' | ||
s.author = { "Srdan Rasic" => "[email protected]" } | ||
s.source = { :git => "https://github.com/DeclarativeHub/ReactiveKit.git", :tag => "v3.14.0" } | ||
s.source = { :git => "https://github.com/DeclarativeHub/ReactiveKit.git", :tag => "v3.14.1" } | ||
|
||
s.ios.deployment_target = '8.0' | ||
s.osx.deployment_target = '10.11' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// | ||
// Atomic.swift | ||
// ReactiveKit | ||
// | ||
// Created by Srdan Rasic on 06/11/2019. | ||
// Copyright © 2019 DeclarativeHub. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
struct Atomic<T> { | ||
|
||
private var _value: T | ||
private let lock: NSLocking | ||
|
||
init(_ value: T, lock: NSLocking = NSRecursiveLock()) { | ||
self._value = value | ||
self.lock = lock | ||
} | ||
|
||
var value: T { | ||
get { | ||
lock.lock() | ||
let value = _value | ||
lock.unlock() | ||
return value | ||
} | ||
set { | ||
lock.lock() | ||
_value = newValue | ||
lock.unlock() | ||
} | ||
} | ||
|
||
mutating func mutate(_ block: (T) -> T) -> T { | ||
lock.lock() | ||
let newValue = block(_value) | ||
_value = newValue | ||
lock.unlock() | ||
return newValue | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters