Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ x.y.z Release notes (yyyy-MM-dd)
* Conform `@ThreadSafe` and `ThreadSafeReference` to `Sendable`.

### Fixed
* Fix `RLMCollectionIterator` where `RLMCollectionIterator` contents were not RLMObject.
This is for users using the optional `RLMSupport.swift` file.
* Change default request timeout for `RLMApp` from 6 seconds to 60 seconds.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bad changeset merge.

* Allow `@AutoOpen` to return a realm for any server error on synchronisation.
* Do not allow `progress` state changes for `@AutoOpen` and `@AsyncOpen` after
changing state to `open(let realm)` or `error(let error)`.
Expand Down
4 changes: 2 additions & 2 deletions Realm/Swift/RLMSupport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public struct RLMCollectionIterator: IteratorProtocol {
iteratorBase = NSFastEnumerationIterator(collection)
}

public mutating func next() -> RLMObject? {
return iteratorBase.next() as! RLMObject?
public mutating func next() -> AnyObject? {
return iteratorBase.next() as AnyObject?
}
}

Expand Down
25 changes: 25 additions & 0 deletions Realm/Tests/Swift/SwiftArrayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -513,4 +513,29 @@ class SwiftRLMArrayTests: RLMTestCase {
XCTAssertEqual(Int32(20), (sortedByAge[0] as! EmployeeObject).age)
XCTAssertEqual(Int32(40), (sortedByName[0] as! EmployeeObject).age)
}

func testRLMArrayIterationForObjectAndNonObjectTypes() {
let rlmArrayEmbedded = RLMArray<EmbeddedIntObject>(objectClassName: EmbeddedIntObject.className())
let obj = EmbeddedIntObject()
obj.intCol = 42
rlmArrayEmbedded.add(obj)
for obj in rlmArrayEmbedded {
XCTAssertEqual(obj.intCol, 42)
}

let rlmArrayObject = RLMArray<IntObject>(objectClassName: IntObject.className())
let intObject = IntObject()
intObject.intCol = 42
rlmArrayObject.add(intObject)
for obj in rlmArrayObject {
XCTAssertEqual(obj.intCol, 42)
}

let rlmArrayPrimitive = RLMArray<NSString>(objectClassName: "NSString")
let str = "foo"
rlmArrayPrimitive.add(str as NSString)
for obj in rlmArrayPrimitive {
XCTAssertEqual(obj as! NSString, "foo" as NSString)
}
}
}