Skip to content
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

Changes in develop that were never merged #217

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
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
17 changes: 17 additions & 0 deletions .github/workflows/docs.yml
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

2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Lint, build and test

on:
pull_request:
branches: [main]
branches: [main, develop]

jobs:
build:
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/rebase.yml
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 }}
25 changes: 25 additions & 0 deletions .github/workflows/swift.yml
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
21 changes: 21 additions & 0 deletions .github/workflows/swiftlint.yml
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 }}
9 changes: 3 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion Cartfile.resolved
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"
76 changes: 38 additions & 38 deletions Package.swift
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")
],
path: "Sources"),
.testTarget(
name: "RxRealmTests",
dependencies: ["RxRealm"]
)
],
swiftLanguageVersions: [.v5]
)
54 changes: 30 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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:

Expand All @@ -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:

Expand All @@ -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:

Expand All @@ -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))")
Expand All @@ -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 {
Expand All @@ -182,7 +186,7 @@ Observable.from(messages)
})
```

##### `rx.delete()`
### `rx.delete()`

Deleting object(s) from an existing realm reference:

Expand All @@ -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:

Expand All @@ -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.

Expand All @@ -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:
Expand All @@ -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.

Expand All @@ -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`:

Expand All @@ -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")
],
targets: [
.target(name: "Example", dependencies: ["RxRealm"])
Expand All @@ -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.
Loading
Loading