-
Notifications
You must be signed in to change notification settings - Fork 276
Changes in develop that were never merged #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
267cc8b
14d0f7b
35ecf4f
9ca726e
d0439f2
dcce784
9687194
2ac517e
3c539b1
db3b17f
3a5c0d6
aba530c
0986e05
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: Lint, build and test | |
|
||
on: | ||
pull_request: | ||
branches: [main] | ||
branches: [main, develop] | ||
|
||
jobs: | ||
build: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
github "ReactiveX/RxSwift" "6.5.0" | ||
github "realm/realm-cocoa" "v10.21.1" | ||
github "realm/realm-cocoa" "v10.28.6" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
Comment on lines
+30
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nitpick] The dependency ordering has changed - RealmSwift is now listed before RxSwift, which differs from the original order. Consider maintaining consistent dependency ordering for better readability. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
], | ||
path: "Sources"), | ||
.testTarget( | ||
name: "RxRealmTests", | ||
dependencies: ["RxRealm"] | ||
) | ||
], | ||
swiftLanguageVersions: [.v5] | ||
) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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<Array<T>, RealmChangeset?>` | ||||||
|
||||||
```swift | ||||||
|
@@ -107,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. | ||||||
|
@@ -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 */ ) | ||||||
.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))") | ||||||
|
@@ -173,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 { | ||||||
|
@@ -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,21 +212,21 @@ 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: | ||||||
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 | ||||||
### b) Animated binding with RxRealmDataSources | ||||||
|
||||||
The separate library [RxRealmDataSources](https://github.com/RxSwiftCommunity/RxRealmDataSources) mimics the default data sources library behavior for RxSwift. | ||||||
|
||||||
|
@@ -242,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: | ||||||
|
@@ -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,15 +286,15 @@ 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: | ||||||
|
||||||
```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") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The version reference "5.0.4" in the Swift Package Manager example is inconsistent with the podspec version "5.1.0". Consider updating this to match the current version being released.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
], | ||||||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Swift version 5.3.2 is outdated compared to the swift-tools-version:5.7 specified in Package.swift. Consider updating to a more recent Swift version for consistency.
Copilot uses AI. Check for mistakes.