Skip to content

Commit

Permalink
Fix initial event for ObservableCollection and related memory leak.
Browse files Browse the repository at this point in the history
  • Loading branch information
srdanrasic committed Dec 18, 2015
1 parent def100e commit c7e02eb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions ReactiveKit.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Pod::Spec.new do |s|
s.name = "ReactiveKit"
s.version = "1.0.9"
s.version = "1.0.10"
s.summary = "A Swift Reactive Programming Framework"
s.description = "ReactiveKit is a collection of Swift frameworks for reactive and functional reactive programming."
s.homepage = "https://github.com/ReactiveKit/ReactiveKit"
s.license = 'MIT'
s.author = { "Srdan Rasic" => "[email protected]" }
s.source = { :git => "https://github.com/ReactiveKit/ReactiveKit.git", :tag => "v1.0.9" }
s.source = { :git => "https://github.com/ReactiveKit/ReactiveKit.git", :tag => "v1.0.10" }

s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.9'
Expand Down
2 changes: 1 addition & 1 deletion ReactiveKit/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0.9</string>
<string>1.0.10</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
10 changes: 5 additions & 5 deletions ReactiveKit/ObservableCollection/ObservableCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public protocol ObservableCollectionType: CollectionType, StreamType {

public final class ObservableCollection<Collection: CollectionType>: ActiveStream<ObservableCollectionEvent<Collection>>, ObservableCollectionType {

private var collectionEvent: ObservableCollectionEvent<Collection>! = nil
private var _collection: Collection! = nil

public var collection: Collection {
return collectionEvent.collection
return _collection
}

public init(_ collection: Collection) {
collectionEvent = ObservableCollectionEvent.initial(collection)
_collection = collection
super.init()
}

Expand All @@ -51,13 +51,13 @@ public final class ObservableCollection<Collection: CollectionType>: ActiveStrea
}

public override func next(event: ObservableCollectionEvent<Collection>) {
collectionEvent = event
_collection = event.collection
super.next(event)
}

public override func observe(on context: ExecutionContext? = ImmediateOnMainExecutionContext, observer: Observer) -> DisposableType {
let disposable = super.observe(on: context, observer: observer)
observer(collectionEvent)
observer(ObservableCollectionEvent.initial(collection))
return disposable
}

Expand Down

0 comments on commit c7e02eb

Please sign in to comment.