Skip to content

Commit 7f291c2

Browse files
committed
Cleanup
1 parent d086baf commit 7f291c2

File tree

2 files changed

+26
-26
lines changed

2 files changed

+26
-26
lines changed

Sources/DiffableTextKit/Models/Context.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,13 @@ extension Context {
164164
//=------------------------------------------------------------------------=
165165

166166
/// Use this method on view update.
167-
@inlinable public mutating func merge(_ status: Status, with cache: inout Cache,
168-
and options: Synchronize) throws -> Update {
167+
///
168+
/// Merges inputs unless an optional constraint is broken.
169+
///
170+
/// - Throws: A message describing the optional constraint that was broken.
171+
///
172+
@inlinable @inline(never) public mutating func merge(_ status: Status,
173+
with cache: inout Cache, and options: Synchronize) throws -> Update {
169174
var update = Update()
170175
//=--------------------------------------=
171176
// Values
@@ -206,8 +211,8 @@ extension Context {
206211
//=------------------------------------------------------------------------=
207212

208213
/// Use this method on changes to text.
209-
@inlinable public mutating func merge<T>(_ text: String, in range: Range<Offset<T>>,
210-
with cache: inout Cache) throws -> Update {
214+
@inlinable @inline(never) public mutating func merge<T>(_ text: String,
215+
in range: Range<Offset<T>>, with cache: inout Cache) throws -> Update {
211216
var update = Update()
212217
//=--------------------------------------=
213218
// Layout
@@ -240,8 +245,8 @@ extension Context {
240245
//=------------------------------------------------------------------------=
241246

242247
/// Use this method on changes to selection.
243-
@inlinable public mutating func merge<T>(_ selection: Range<Offset<T>>,
244-
with options: Resolve) -> Update {
248+
@inlinable @inline(never) public mutating func merge<T>(
249+
_ selection: Range<Offset<T>>, with options: Resolve) -> Update {
245250
var update = Update()
246251
//=--------------------------------------=
247252
// Layout

Sources/DiffableTextKitXUIKit/DiffableTextField.swift

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
102102
@usableFromInline var sidestream = Sidestream()
103103

104104
//=--------------------------------------------------------------------=
105-
// MARK: Transformations
105+
// MARK: Events
106106
//=--------------------------------------------------------------------=
107107

108108
@inlinable @inline(never) func setup(
@@ -155,8 +155,16 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
155155
self.synchronize(.acyclical)
156156
}
157157

158+
@inlinable @inline(never) public func textFieldDidBeginEditing(_ view: UITextField) {
159+
self.synchronize([])
160+
}
161+
162+
@inlinable @inline(never) public func textFieldDidEndEditing(_ view: UITextField) {
163+
self.synchronize([])
164+
}
165+
158166
//=--------------------------------------------------------------------=
159-
// MARK: Events
167+
// MARK: Interactions
160168
//=--------------------------------------------------------------------=
161169

162170
@inlinable @inline(never)
@@ -185,7 +193,7 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
185193
// Cancellation
186194
//=----------------------------------=
187195
} catch let reason {
188-
Brrr.cancellation << Info(reason)
196+
Brrr.cancellation << reason
189197
}
190198
//=----------------------------------=
191199
// Decline Automatic Insertion
@@ -223,24 +231,12 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
223231
}
224232
}
225233

226-
//=--------------------------------------------------------------------=
227-
// MARK: Events
228-
//=--------------------------------------------------------------------=
229-
230-
@inlinable public func textFieldShouldReturn(_ view: UITextField) -> Bool {
234+
@inlinable @inline(never) public func textFieldShouldReturn(_ view: UITextField) -> Bool {
231235
self.downstream.dismiss()
232236
self.sidestream.onSubmit?()
233237
return true
234238
}
235239

236-
@inlinable public func textFieldDidBeginEditing(_ view: UITextField) {
237-
self.synchronize([])
238-
}
239-
240-
@inlinable public func textFieldDidEndEditing(_ view: UITextField) {
241-
self.synchronize([])
242-
}
243-
244240
//=--------------------------------------------------------------------=
245241
// MARK: Synchronization
246242
//=--------------------------------------------------------------------=
@@ -258,11 +254,10 @@ public struct DiffableTextField<Style: DiffableTextStyle>: UIViewRepresentable {
258254
//=------------------------------=
259255
self.push(update)
260256
//=----------------------------------=
261-
// Cyclical
257+
// Unsynchronizable
262258
//=----------------------------------=
263-
} catch let cyclical {
264-
Brrr.unsynchronizable << Info(cyclical)
265-
Brrr.dismiss << Info([.mark("cyclical"), "view updates are prohibited"])
259+
} catch let reason {
260+
Brrr.unsynchronizable << reason
266261
//=------------------------------=
267262
// Dismiss
268263
//=------------------------------=

0 commit comments

Comments
 (0)