From 267cc8b587a5d5c74b57105050f9838cf20e2541 Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Tue, 7 May 2024 20:02:10 -0400 Subject: [PATCH 01/13] Bump version to v5.1.0 Signed-off-by: Joseph Mattello --- CHANGELOG.md | 9 +++------ RxRealm.podspec | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb05103..fe6af2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,15 +2,12 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. -### [5.0.8](https://github.com/RxSwiftCommunity/RxRealm/branches/compare/v5.0.8%0Dv5.0.7) (2024-05-07) +## [5.1.0](https://github.com/RxSwiftCommunity/RxRealm/branches/compare/v5.1.0%0Dv5.0.7) (2024-05-07) -### [5.0.6](https://github.com/RxSwiftCommunity/RxRealm/branches/compare/v5.0.6%0Dv5.0.5) (2023-10-29) +### Fixes -### 5.0.5 (2022-03-09) +- Update SPM and CocoaPods packages for updated `Realm.swift` packaging linking -## [5.0.8](https://github.com/RxSwiftCommunity/RxRealm/branches/compare/v5.0.8%0Dv5.0.7) (2024-05-07) - -- Merge pull request #210 from trmquang93/main; override namespace Observable ## [5.0.7](https://github.com/RxSwiftCommunity/RxRealm/branches/compare/v5.0.7%0Dv5.0.6) (2024-03-08) diff --git a/RxRealm.podspec b/RxRealm.podspec index f60701d..806c5e7 100644 --- a/RxRealm.podspec +++ b/RxRealm.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "RxRealm" # Version to always follow latest tag, with fallback to major - s.version = "5.0.8" + s.version = "5.1.0" s.license = "MIT" s.description = <<-DESC This is an Rx extension that provides an easy and straight-forward way From 14d0f7b2bf9d8a8bfd365e4b57ede8a958940bcf Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Tue, 7 May 2024 23:24:54 -0400 Subject: [PATCH 02/13] Remove public typealias Obs = RxSwift.Observable Signed-off-by: Joseph Mattello --- Sources/RxRealm/RxRealm.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/RxRealm/RxRealm.swift b/Sources/RxRealm/RxRealm.swift index 326bb3a..8dc2eae 100644 --- a/Sources/RxRealm/RxRealm.swift +++ b/Sources/RxRealm/RxRealm.swift @@ -10,8 +10,6 @@ import Foundation import RealmSwift import RxSwift -public typealias Observable = RxSwift.Observable - public enum RxRealmError: Error { case objectDeleted case unknown From 35ecf4f5c02bdff481cf5a79884f2f754601d421 Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Tue, 7 May 2024 23:25:11 -0400 Subject: [PATCH 03/13] Update Package.swift for modern spm, dynamic lib Signed-off-by: Joseph Mattello --- Package.swift | 76 +++++++++++++++++++++++++-------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/Package.swift b/Package.swift index 91be267..54bb5fd 100644 --- a/Package.swift +++ b/Package.swift @@ -1,41 +1,41 @@ -// swift-tools-version:5.0 -// The swift-tools-version declares the minimum version of Swift required to build this package. +// swift-tools-version:5.7 import PackageDescription -let package = Package(name: "RxRealm", - platforms: [ - .macOS(.v10_10), .iOS(.v11), .tvOS(.v9), .watchOS(.v3) - ], - products: [ - // Products define the executables and libraries produced by a package, and make them visible to other packages. - .library(name: "RxRealm", - targets: ["RxRealm"]) - ], - - dependencies: [ - // Dependencies declare other packages that this package depends on. - .package(url: "https://github.com/realm/realm-swift.git", .upToNextMajor(from: "10.21.1")), - .package(url: "https://github.com/ReactiveX/RxSwift.git", .upToNextMajor(from: "6.5.0")) - ], - - targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages which this package depends on. - .target(name: "RxRealm", - dependencies: [ - .product(name: "RxSwift", package: "RxSwift"), - .product(name: "RealmSwift", package: "Realm"), - .product(name: "RxCocoa", package: "RxSwift") - ], - path: "Sources"), - .testTarget(name: "RxRealmTests", - dependencies: [ - .byName(name: "RxRealm"), - .product(name: "RxSwift", package: "RxSwift"), - .product(name: "RxBlocking", package: "RxSwift"), - .product(name: "RealmSwift", package: "Realm"), - .product(name: "RxCocoa", package: "RxSwift") - ]) - ], - swiftLanguageVersions: [.v5]) +let package = Package( + name: "RxRealm", + platforms: [ + .macOS(.v10_13), .iOS(.v12), .tvOS(.v12), .watchOS(.v4) + ], + products: [ + .library( + name: "RxRealm", + type: .static, + targets: ["RxRealm"] + ), + .library( + name: "RxRealm-Dynamic", + type: .dynamic, + targets: ["RxRealm"] + ) + ], + dependencies: [ + .package(url: "https://github.com/realm/realm-swift.git", from: "10.50.0"), + .package(url: "https://github.com/ReactiveX/RxSwift.git", from: "6.7.1") + ], + targets: [ + .target( + name: "RxRealm", + dependencies: [ + .product(name: "RealmSwift", package: "realm-swift"), + .product(name: "RxSwift", package: "RxSwift"), + .product(name: "RxCocoa", package: "RxSwift") + ], + path: "Sources"), + .testTarget( + name: "RxRealmTests", + dependencies: ["RxRealm"] + ) + ], + swiftLanguageVersions: [.v5] +) From 9ca726e1980fd3a30c270067b078b237d46cd132 Mon Sep 17 00:00:00 2001 From: Marcus Wu Date: Tue, 14 Jun 2022 12:48:10 +0800 Subject: [PATCH 04/13] Update example project ruby denpendencies version From d0439f2e67d1ed99260db09dc76c8b93894f5959 Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Fri, 21 Jan 2022 22:06:05 -0500 Subject: [PATCH 05/13] Update README.md Fix minor Markdown lint issues change maintainer info chage version in swift pm example Signed-off-by: Joseph Mattello --- README.md | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 17058a5..3948068 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ This library is a thin wrapper around __RealmSwift__ ( [Realm Docs](https://real RxRealm can be used to create `Observable`s from objects of type `Results`, `List`, `LinkingObjects` or `AnyRealmCollection`. These types are typically used to load and observe object collections from the Realm Mobile Database. -##### `Observable.collection(from:synchronousStart:)` +### `Observable.collection(from:synchronousStart:)` + Emits an event each time the collection changes: ```swift @@ -38,7 +39,8 @@ Observable.collection(from: laps) The above prints out "X laps" each time a lap is added or removed from the database. If you set `synchronousStart` to `true` (the default value), the first element will be emitted synchronously - e.g. when you're binding UI it might not be possible for an asynchronous notification to come through. -##### `Observable.array(from:synchronousStart:)` +### `Observable.array(from:synchronousStart:)` + Upon each change fetches a snapshot of the Realm collection and converts it to an array value (for example if you want to use array methods on the collection): ```swift @@ -54,7 +56,8 @@ Observable.array(from: laps) }) ``` -##### `Observable.changeset(from:synchronousStart:)` +### `Observable.changeset(from:synchronousStart:)` + Emits every time the collection changes and provides the exact indexes that has been deleted, inserted or updated: ```swift @@ -76,7 +79,8 @@ Observable.changeset(from: laps) }) ``` -##### `Observable.arrayWithChangeset(from:synchronousStart:)` +### `Observable.arrayWithChangeset(from:synchronousStart:)` + Combines the result of `Observable.array(from:)` and `Observable.changeset(from:)` returning an `Observable, RealmChangeset?>` ```swift @@ -122,7 +126,7 @@ Observable.from(object: ticker, properties: ["name", "id", "family"]) ... ## Write transactions -##### `rx.add()` +### `rx.add()` Writing objects to **existing** realm reference. You can add newly created objects to a Realm that you already have initialized: @@ -136,7 +140,7 @@ Observable.from(messages) Be careful, this will retain your Realm until the `Observable` completes or errors out. -##### `Realm.rx.add()` +### `Realm.rx.add()` Writing to the default Realm. You can leave it to RxRealm to grab the default Realm on any thread your subscribe and write objects to it: @@ -147,7 +151,7 @@ Observable.from(messages) .subscribe(Realm.rx.add()) ``` -###### `Realm.rx.add(configuration:)` +### `Realm.rx.add(configuration:)` Writing to a **custom** Realm. If you want to switch threads and not use the default Realm, provide a `Realm.Configuration`. You an also provide an error handler for the observer to be called if either creating the realm reference or the write transaction raise an error: @@ -157,7 +161,7 @@ var config = Realm.Configuration() let messages = [Message("hello"), Message("world")] Observable.from(messages) - .observeOn( /* you can switch threads here */ ) + .observeOn( /* you can switch threads here */ ) .subscribe(Realm.rx.add(configuration: config, onError: {elements, error in if let elements = elements { print("Error \(error.localizedDescription) while saving objects \(String(describing: elements))") @@ -182,7 +186,7 @@ Observable.from(messages) }) ``` -##### `rx.delete()` +### `rx.delete()` Deleting object(s) from an existing realm reference: @@ -195,7 +199,7 @@ Observable.from(messages) Be careful, this will retain your realm until the `Observable` completes or errors out. -##### `Realm.rx.delete()` +### `Realm.rx.delete()` Deleting from the object's realm automatically. You can leave it to RxRealm to grab the Realm from the first object and use it: @@ -208,7 +212,7 @@ Observable.from(someCollectionOfPersistedObjects) RxRealm does not depend on UIKit/Cocoa and it doesn't provide built-in way to bind Realm collections to UI components. -#### a) Non-animated binding +### a) Non-animated binding You can use the built-in RxCocoa `bindTo(_:)` method, which will automatically drive your table view from your Realm results: @@ -222,7 +226,7 @@ Observable.from( [Realm collection] ) .addDisposableTo(bag) ``` -#### b) Animated binding with RxRealmDataSources +### b) Animated binding with RxRealmDataSources The separate library [RxRealmDataSources](https://github.com/RxSwiftCommunity/RxRealmDataSources) mimics the default data sources library behavior for RxSwift. @@ -262,7 +266,7 @@ Further you're welcome to peak into the __RxRealmTests__ folder of the example a This library depends on both __RxSwift__ and __RealmSwift__ 1.0+. -#### CocoaPods +### CocoaPods RxRealm requires CocoaPods 1.1.x or higher. @@ -272,7 +276,7 @@ RxRealm is available through [CocoaPods](http://cocoapods.org). To install it, s pod "RxRealm" ``` -#### Carthage +### Carthage To integrate RxRealm into your Xcode project using Carthage, specify it in your `Cartfile`: @@ -282,7 +286,7 @@ github "RxSwiftCommunity/RxRealm" Run `carthage update` to build the framework and drag the built `RxRealm.framework` into your Xcode project. -#### Swift Package Manager +### Swift Package Manager In your Package.swift: @@ -290,7 +294,7 @@ In your Package.swift: let package = Package( name: "Example", dependencies: [ - .package(url: "https://github.com/RxSwiftCommunity/RxRealm.git", from: "1.0.1") + .package(url: "https://github.com/RxSwiftCommunity/RxRealm.git", from: "5.0.4") ], targets: [ .target(name: "Example", dependencies: ["RxRealm"]) @@ -304,6 +308,8 @@ let package = Package( ## License -This library belongs to _RxSwiftCommunity_. Maintainer is [Marin Todorov](https://github.com/icanzilb). +This library belongs to _RxSwiftCommunity_. +Maintainer is [Joe Mattiello](https://github.com/JoeMatt). +Previous maintainer was [Marin Todorov](https://github.com/icanzilb). RxRealm is available under the MIT license. See the LICENSE file for more info. From dcce7849a68b26b901dd7a974bfeee90385500b2 Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Fri, 21 Jan 2022 22:23:41 -0500 Subject: [PATCH 06/13] Add swiftlint action Signed-off-by: Joseph Mattello --- .github/workflows/swiftlint.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/swiftlint.yml diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml new file mode 100644 index 0000000..a04f4e7 --- /dev/null +++ b/.github/workflows/swiftlint.yml @@ -0,0 +1,21 @@ +name: Swift Lint + +on: + pull_request: + paths: + - ".github/workflows/swiftlint.yml" + - ".swiftlint.yml" + - "Examples/**/*.swift" + - "Sources/**/*.swift" + - "Tests/**/*.swift" + +jobs: + swift-lint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: GitHub Action for SwiftLint + uses: norio-nomura/action-swiftlint@3.2.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 968719484a9e408e5c371b4458df05d0d8b1a2d9 Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Fri, 21 Jan 2022 22:23:51 -0500 Subject: [PATCH 07/13] add swift test action Signed-off-by: Joseph Mattello --- .github/workflows/swift.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/swift.yml diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 0000000..5a0bf60 --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,25 @@ +name: Swift PM + +on: + pull_request: + types: + - reopened + - opened + - synchronize + +jobs: + swift-pm: + + runs-on: macOS-latest + + steps: + - uses: actions/checkout@master + - name: Swift Setup + uses: YOCKOW/Action-setup-swift@v1 + with: + swift-version: '5.3.2' + - run: swift --version + - name: Resolve + run: swift package resolve + - name: Test + run: swift test From 2ac517e46135cd0faa4eb47f6f725ce0ba486a24 Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Fri, 21 Jan 2022 22:24:03 -0500 Subject: [PATCH 08/13] Add /revbase command action Signed-off-by: Joseph Mattello --- .github/workflows/rebase.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/rebase.yml diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml new file mode 100644 index 0000000..1268b55 --- /dev/null +++ b/.github/workflows/rebase.yml @@ -0,0 +1,16 @@ +# Rebase PR branch when someone comments /rebase +on: + issue_comment: + types: [created] +name: Automatic Rebase +jobs: + rebase: + name: Rebase + if: contains(github.event.comment.body, '/rebase') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: Automatic Rebase + uses: cirrus-actions/rebase@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 3c539b16a328d7fe9996d10aa61c3a328262717b Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Fri, 21 Jan 2022 22:24:30 -0500 Subject: [PATCH 09/13] Edit pull request action to add develop branch Signed-off-by: Joseph Mattello --- .github/workflows/pull_request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index df74c65..591ade0 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -2,7 +2,7 @@ name: Lint, build and test on: pull_request: - branches: [main] + branches: [main, develop] jobs: build: From db3b17f415c03552015db29462b9ef31663d0549 Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Fri, 21 Jan 2022 22:25:03 -0500 Subject: [PATCH 10/13] Add jazzy docs action Signed-off-by: Joseph Mattello --- .github/workflows/docs.yml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..fa264dd --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,17 @@ +name: PublishDocumentation + +on: + release: + types: [published] + +jobs: + deploy_docs: + runs-on: macos-latest + steps: + - uses: actions/checkout@v1 + - name: Publish Jazzy Docs + uses: steven0351/publish-jazzy-docs@v1 + with: + personal_access_token: ${{ secrets.ACCESS_TOKEN }} + config: .jazzy.yaml + From 3a5c0d6fda7f30cd82eb9ff324932a5fc14fd83d Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Fri, 21 Jan 2022 23:27:01 -0500 Subject: [PATCH 11/13] Add CODEOWNERS --- .github/CODEOWNERS | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..73fe78c --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# Lines starting with '#' are comments. +# Each line is a file pattern followed by one or more owners. + +# These owners will be the default owners for everything in the repo. +* @JoeMatt From aba530caca5e7ff4260a4ce2049a2b4ec610ae39 Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Fri, 21 Jan 2022 23:44:14 -0500 Subject: [PATCH 12/13] closes #168 fix deprecated api's in README Signed-off-by: Joseph Mattello --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3948068..141027d 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ Observable.from(object: ticker) .map { ticker -> String in return "\(ticker.ticks) ticks" } - .bindTo(footer.rx.text) + .bind(to: footer.rx.text) ``` This API uses the [Realm object notifications](https://realm.io/news/realm-objc-swift-2.4/) under the hood to listen for changes. @@ -161,7 +161,7 @@ var config = Realm.Configuration() let messages = [Message("hello"), Message("world")] Observable.from(messages) - .observeOn( /* you can switch threads here */ ) + .observe(on: /* you can switch threads here */ ) .subscribe(Realm.rx.add(configuration: config, onError: {elements, error in if let elements = elements { print("Error \(error.localizedDescription) while saving objects \(String(describing: elements))") @@ -177,7 +177,7 @@ If you want to create a Realm on a different thread manually, allowing you to ha let messages = [Message("hello"), Message("world")] Observable.from(messages) - .observeOn( /* you can switch threads here */ ) + .observe(on: /* you can switch threads here */ ) .subscribe(onNext: {messages in let realm = try! Realm() try! realm.write { @@ -214,16 +214,16 @@ RxRealm does not depend on UIKit/Cocoa and it doesn't provide built-in way to bi ### a) Non-animated binding -You can use the built-in RxCocoa `bindTo(_:)` method, which will automatically drive your table view from your Realm results: +You can use the built-in RxCocoa `bind(to:)` method, which will automatically drive your table view from your Realm results: ```swift Observable.from( [Realm collection] ) - .bindTo(tableView.rx.items) {tv, ip, element in + .bind(to: tableView.rx.items) {tv, ip, element in let cell = tv.dequeueReusableCell(withIdentifier: "Cell")! cell.textLabel?.text = element.text return cell } - .addDisposableTo(bag) + .disposed(by: bag) ``` ### b) Animated binding with RxRealmDataSources @@ -246,8 +246,8 @@ let laps = Observable.changeset(from: lapsList) // bind to table view laps - .bindTo(tableView.rx.realmChanges(dataSource)) - .addDisposableTo(bag) + .bind(to: tableView.rx.realmChanges(dataSource)) + .disposed(by: bag) ``` The data source will reflect all changes via animations to the table view: From 0986e05711bbcff25f3abadc9fad4ddbe749e9c0 Mon Sep 17 00:00:00 2001 From: Joseph Mattello Date: Thu, 1 Sep 2022 00:38:44 -0400 Subject: [PATCH 13/13] carthage update --- Cartfile.resolved | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cartfile.resolved b/Cartfile.resolved index 1191c58..d102df0 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,2 +1,2 @@ github "ReactiveX/RxSwift" "6.5.0" -github "realm/realm-cocoa" "v10.21.1" +github "realm/realm-cocoa" "v10.28.6"