Support typed errors. Misc formatting

This commit is contained in:
John Estropia
2024-09-10 11:14:39 +09:00
parent c9e091a6a4
commit 5dcf29011a
74 changed files with 3987 additions and 1441 deletions

View File

@@ -37,8 +37,10 @@ extension DataStack {
- parameter object: the `DynamicObject` to observe changes from
- returns: an `ObjectMonitor` that monitors changes to `object`
*/
public func monitorObject<O: DynamicObject>(_ object: O) -> ObjectMonitor<O> {
public func monitorObject<O: DynamicObject>(
_ object: O
) -> ObjectMonitor<O> {
Internals.assert(
Thread.isMainThread,
"Attempted to observe objects from \(Internals.typeName(self)) outside the main thread."
@@ -53,8 +55,11 @@ extension DataStack {
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
public func monitorList<O>(_ from: From<O>, _ fetchClauses: FetchClause...) -> ListMonitor<O> {
public func monitorList<O>(
_ from: From<O>,
_ fetchClauses: FetchClause...
) -> ListMonitor<O> {
return self.monitorList(from, fetchClauses)
}
@@ -65,8 +70,11 @@ extension DataStack {
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
public func monitorList<O>(_ from: From<O>, _ fetchClauses: [FetchClause]) -> ListMonitor<O> {
public func monitorList<O>(
_ from: From<O>,
_ fetchClauses: [FetchClause]
) -> ListMonitor<O> {
Internals.assert(
Thread.isMainThread,
"Attempted to observe objects from \(Internals.typeName(self)) outside the main thread."
@@ -99,8 +107,10 @@ extension DataStack {
- parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses
- returns: a `ListMonitor` for a list of `DynamicObject`s that satisfy the specified `FetchChainableBuilderType`
*/
public func monitorList<B: FetchChainableBuilderType>(_ clauseChain: B) -> ListMonitor<B.ObjectType> {
public func monitorList<B: FetchChainableBuilderType>(
_ clauseChain: B
) -> ListMonitor<B.ObjectType> {
return self.monitorList(
clauseChain.from,
clauseChain.fetchClauses
@@ -114,8 +124,12 @@ extension DataStack {
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ fetchClauses: FetchClause...) {
public func monitorList<O>(
createAsynchronously: @escaping (ListMonitor<O>) -> Void,
_ from: From<O>,
_ fetchClauses: FetchClause...
) {
self.monitorList(
createAsynchronously: createAsynchronously,
from,
@@ -130,8 +144,12 @@ extension DataStack {
- parameter from: a `From` clause indicating the entity type
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ fetchClauses: [FetchClause]) {
public func monitorList<O>(
createAsynchronously: @escaping (ListMonitor<O>) -> Void,
_ from: From<O>,
_ fetchClauses: [FetchClause]
) {
Internals.assert(
Thread.isMainThread,
"Attempted to observe objects from \(Internals.typeName(self)) outside the main thread."
@@ -169,8 +187,11 @@ extension DataStack {
- parameter createAsynchronously: the closure that receives the created `ListMonitor` instance
- parameter clauseChain: a `FetchChainableBuilderType` built from a chain of clauses
*/
public func monitorList<B: FetchChainableBuilderType>(createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void, _ clauseChain: B) {
public func monitorList<B: FetchChainableBuilderType>(
createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void,
_ clauseChain: B
) {
self.monitorList(
createAsynchronously: createAsynchronously,
clauseChain.from,
@@ -186,8 +207,12 @@ extension DataStack {
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
public func monitorSectionedList<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: FetchClause...) -> ListMonitor<O> {
public func monitorSectionedList<O>(
_ from: From<O>,
_ sectionBy: SectionBy<O>,
_ fetchClauses: FetchClause...
) -> ListMonitor<O> {
return self.monitorSectionedList(
from,
sectionBy,
@@ -203,8 +228,12 @@ extension DataStack {
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
- returns: a `ListMonitor` instance that monitors changes to the list
*/
public func monitorSectionedList<O>(_ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: [FetchClause]) -> ListMonitor<O> {
public func monitorSectionedList<O>(
_ from: From<O>,
_ sectionBy: SectionBy<O>,
_ fetchClauses: [FetchClause]
) -> ListMonitor<O> {
Internals.assert(
Thread.isMainThread,
"Attempted to observe objects from \(Internals.typeName(self)) outside the main thread."
@@ -239,8 +268,10 @@ extension DataStack {
- parameter clauseChain: a `SectionMonitorBuilderType` built from a chain of clauses
- returns: a `ListMonitor` for a list of `DynamicObject`s that satisfy the specified `SectionMonitorBuilderType`
*/
public func monitorSectionedList<B: SectionMonitorBuilderType>(_ clauseChain: B) -> ListMonitor<B.ObjectType> {
public func monitorSectionedList<B: SectionMonitorBuilderType>(
_ clauseChain: B
) -> ListMonitor<B.ObjectType> {
return self.monitorSectionedList(
clauseChain.from,
clauseChain.sectionBy,
@@ -256,8 +287,13 @@ extension DataStack {
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorSectionedList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: FetchClause...) {
public func monitorSectionedList<O>(
createAsynchronously: @escaping (ListMonitor<O>) -> Void,
_ from: From<O>,
_ sectionBy: SectionBy<O>,
_ fetchClauses: FetchClause...
) {
self.monitorSectionedList(
createAsynchronously: createAsynchronously,
from,
@@ -274,8 +310,13 @@ extension DataStack {
- parameter sectionBy: a `SectionBy` clause indicating the keyPath for the attribute to use when sorting the list into sections.
- parameter fetchClauses: a series of `FetchClause` instances for fetching the object list. Accepts `Where`, `OrderBy`, and `Tweak` clauses.
*/
public func monitorSectionedList<O>(createAsynchronously: @escaping (ListMonitor<O>) -> Void, _ from: From<O>, _ sectionBy: SectionBy<O>, _ fetchClauses: [FetchClause]) {
public func monitorSectionedList<O>(
createAsynchronously: @escaping (ListMonitor<O>) -> Void,
_ from: From<O>,
_ sectionBy: SectionBy<O>,
_ fetchClauses: [FetchClause]
) {
Internals.assert(
Thread.isMainThread,
"Attempted to observe objects from \(Internals.typeName(self)) outside the main thread."
@@ -314,8 +355,11 @@ extension DataStack {
- parameter createAsynchronously: the closure that receives the created `ListMonitor` instance
- parameter clauseChain: a `SectionMonitorBuilderType` built from a chain of clauses
*/
public func monitorSectionedList<B: SectionMonitorBuilderType>(createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void, _ clauseChain: B) {
public func monitorSectionedList<B: SectionMonitorBuilderType>(
createAsynchronously: @escaping (ListMonitor<B.ObjectType>) -> Void,
_ clauseChain: B
) {
self.monitorSectionedList(
createAsynchronously: createAsynchronously,
clauseChain.from,