Skip to content

Commit

Permalink
upgraded syntax to swift 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zuthan committed Sep 29, 2015
1 parent e506880 commit 734b252
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.DS_Store
xcuserdata
build/
2 changes: 2 additions & 0 deletions Observable-Swift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,8 @@
65263A941954BC5000B39269 /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0600;
ORGANIZATIONNAME = "Leszek Ślażyński";
TargetAttributes = {
Expand Down
2 changes: 1 addition & 1 deletion Observable-Swift/Event.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public struct Event<T>: UnownableEvent {
_subscriptions.removeAll()
}

public mutating func add(#owner : AnyObject, _ handler : HandlerType) -> SubscriptionType {
public mutating func add(owner owner : AnyObject, _ handler : HandlerType) -> SubscriptionType {
return add(SubscriptionType(owner: owner, handler: handler))
}

Expand Down
2 changes: 1 addition & 1 deletion Observable-Swift/EventReference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class EventReference<T>: OwnableEvent {
event.removeAll()
}

public func add(#owner : AnyObject, _ handler : HandlerType) -> SubscriptionType {
public func add(owner owner : AnyObject, _ handler : HandlerType) -> SubscriptionType {
return event.add(owner: owner, handler)
}

Expand Down
2 changes: 1 addition & 1 deletion Observable-Swift/Observable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public struct Observable<T> : UnownableObservable {
didSet { afterChange.notify(ValueChange(oldValue, value)) }
}

public mutating func unshare(#removeSubscriptions: Bool) {
public mutating func unshare(removeSubscriptions removeSubscriptions: Bool) {
if removeSubscriptions {
beforeChange = EventReference<ValueChange<T>>()
afterChange = EventReference<ValueChange<T>>()
Expand Down
4 changes: 2 additions & 2 deletions Observable-Swift/ObservableChainingProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ public class ObservableChainingProxy<O1: AnyObservable, O2: AnyObservable>: Owna
self.base = base
self.path = path

var beforeSubscription = EventSubscription(owner: self) { [weak self] in
let beforeSubscription = EventSubscription(owner: self) { [weak self] in
self!.beforeChange.notify(self!.targetChangeToValueChange($0))
}

var afterSubscription = EventSubscription(owner: self) { [weak self] in
let afterSubscription = EventSubscription(owner: self) { [weak self] in
self!.afterChange.notify(self!.targetChangeToValueChange($0))
}

Expand Down
2 changes: 1 addition & 1 deletion Observable-Swift/OwningEventReference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class OwningEventReference<T>: EventReference<T> {
event.removeAll()
}

public override func add(#owner : AnyObject, _ handler : HandlerType) -> SubscriptionType {
public override func add(owner owner : AnyObject, _ handler : HandlerType) -> SubscriptionType {
let subscr = event.add(owner: owner, handler)
if owned != nil {
subscr.addOwnedObject(self)
Expand Down
4 changes: 2 additions & 2 deletions Observable-Swift/Protocols.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public protocol AnyEvent {
mutating func removeAll()

/// Create, add and return a subscription with given handler and owner.
mutating func add(#owner : AnyObject, _ handler : ValueType -> ()) -> EventSubscription<ValueType>
mutating func add(owner owner : AnyObject, _ handler : ValueType -> ()) -> EventSubscription<ValueType>

}

Expand Down Expand Up @@ -64,7 +64,7 @@ public protocol WritableObservable : AnyObservable {
/// Observable which is a value type. Elementary observables are value types.
public protocol UnownableObservable : WritableObservable {
/// Unshares events
mutating func unshare(#removeSubscriptions: Bool)
mutating func unshare(removeSubscriptions removeSubscriptions: Bool)
}

/// Observable which is a reference type. Compound observables are reference types.
Expand Down

0 comments on commit 734b252

Please sign in to comment.