From 4b10234529810bef29ada5aed9b36262de4c7859 Mon Sep 17 00:00:00 2001 From: Kyle Van Essen Date: Mon, 25 Jan 2021 12:45:04 -0800 Subject: [PATCH] Replace build with configure as paramter name. --- BlueprintUILists/Sources/HeaderFooter.swift | 4 ++-- BlueprintUILists/Sources/Item.swift | 4 ++-- BlueprintUILists/Sources/List.swift | 4 ++-- CHANGELOG.md | 2 ++ ListableUI/Sources/Content.swift | 6 +++--- ListableUI/Sources/EmbeddedList.swift | 8 ++++---- .../Sources/HeaderFooter/HeaderFooter.swift | 6 +++--- ListableUI/Sources/Item/Item.swift | 6 +++--- ListableUI/Sources/ListProperties.swift | 18 +++++++++--------- ListableUI/Sources/ListView/ListSizing.swift | 2 +- ListableUI/Sources/ListView/ListView.swift | 4 ++-- ListableUI/Sources/ListViewSource.swift | 2 +- 12 files changed, 34 insertions(+), 32 deletions(-) diff --git a/BlueprintUILists/Sources/HeaderFooter.swift b/BlueprintUILists/Sources/HeaderFooter.swift index 905d01970..c5ec8eae7 100644 --- a/BlueprintUILists/Sources/HeaderFooter.swift +++ b/BlueprintUILists/Sources/HeaderFooter.swift @@ -62,7 +62,7 @@ extension HeaderFooter backgroundProvider: background, pressedBackgroundProvider: pressedBackground ), - build: configure + configure: configure ) } @@ -113,7 +113,7 @@ extension HeaderFooter backgroundProvider: background, pressedBackgroundProvider: pressedBackground ), - build: configure + configure: configure ) } } diff --git a/BlueprintUILists/Sources/Item.swift b/BlueprintUILists/Sources/Item.swift index 041add921..eded16fe2 100644 --- a/BlueprintUILists/Sources/Item.swift +++ b/BlueprintUILists/Sources/Item.swift @@ -67,7 +67,7 @@ extension Item backgroundProvider: background, selectedBackgroundProvider: selectedBackground ), - build: configure + configure: configure ) } @@ -123,7 +123,7 @@ extension Item backgroundProvider: background, selectedBackgroundProvider: selectedBackground ), - build: configure + configure: configure ) } } diff --git a/BlueprintUILists/Sources/List.swift b/BlueprintUILists/Sources/List.swift index 97dfea3e9..999fefcfb 100644 --- a/BlueprintUILists/Sources/List.swift +++ b/BlueprintUILists/Sources/List.swift @@ -64,11 +64,11 @@ public struct List : Element /// configured with the provided `ListProperties` builder. public init( sizing : ListSizing = .fillParent, - build : ListProperties.Build + configure : ListProperties.Configure ) { self.sizing = sizing - self.properties = .default(with: build) + self.properties = .default(with: configure) } // diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ef730580..e01d12668 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ ### Changed +- [Rename `build` parameters to `configure`](https://github.com/kyleve/Listable/pull/262), in order to be more consistent within the framework and with Blueprint. + ### Misc # Past Releases diff --git a/ListableUI/Sources/Content.swift b/ListableUI/Sources/Content.swift index d494c674c..cf3cffb81 100644 --- a/ListableUI/Sources/Content.swift +++ b/ListableUI/Sources/Content.swift @@ -81,14 +81,14 @@ public struct Content // MARK: Initialization // - public typealias Build = (inout Content) -> () + public typealias Configure = (inout Content) -> () /// Creates a new instance, configured as needed via the provided builder block. - public init(with build : Build) + public init(with configure : Configure) { self.init() - build(&self) + configure(&self) } /// Creates a new instance with the provided parameters. diff --git a/ListableUI/Sources/EmbeddedList.swift b/ListableUI/Sources/EmbeddedList.swift index fb31b4f2c..5394cf13b 100644 --- a/ListableUI/Sources/EmbeddedList.swift +++ b/ListableUI/Sources/EmbeddedList.swift @@ -30,11 +30,11 @@ public extension Item where Content == EmbeddedList static func list( _ identifier : Identifier, sizing : EmbeddedList.Sizing, - build : ListProperties.Build + configure : ListProperties.Configure ) -> Item { Item( - EmbeddedList(identifier: identifier, build: build), + EmbeddedList(identifier: identifier, configure: configure), sizing: sizing.toStandardSizing, @@ -68,7 +68,7 @@ public struct EmbeddedList : ItemContent // MARK: Initialization // - public init(identifier : Identifier, build : ListProperties.Build) + public init(identifier : Identifier, configure : ListProperties.Configure) { self.contentIdentifier = AnyHashable(identifier) @@ -83,7 +83,7 @@ public struct EmbeddedList : ItemContent autoScrollAction: .none, accessibilityIdentifier: nil, debuggingIdentifier: nil, - build: build + configure: configure ) } diff --git a/ListableUI/Sources/HeaderFooter/HeaderFooter.swift b/ListableUI/Sources/HeaderFooter/HeaderFooter.swift index a99270c51..6bb60b795 100644 --- a/ListableUI/Sources/HeaderFooter/HeaderFooter.swift +++ b/ListableUI/Sources/HeaderFooter/HeaderFooter.swift @@ -28,15 +28,15 @@ public struct HeaderFooter : AnyHeaderFooter // MARK: Initialization // - public typealias Build = (inout HeaderFooter) -> () + public typealias Configure = (inout HeaderFooter) -> () public init( _ content : Content, - build : Build + configure : Configure ) { self.init(content) - build(&self) + configure(&self) } public init( diff --git a/ListableUI/Sources/Item/Item.swift b/ListableUI/Sources/Item/Item.swift index 348b8e67e..19af786d8 100644 --- a/ListableUI/Sources/Item/Item.swift +++ b/ListableUI/Sources/Item/Item.swift @@ -42,15 +42,15 @@ public struct Item : AnyItem // MARK: Initialization // - public typealias Build = (inout Item) -> () + public typealias Configure = (inout Item) -> () public init( _ content : Content, - build : Build + configure : Configure ) { self.init(content) - build(&self) + configure(&self) } public init( diff --git a/ListableUI/Sources/ListProperties.swift b/ListableUI/Sources/ListProperties.swift index 0eee4ce34..0a39d69e9 100644 --- a/ListableUI/Sources/ListProperties.swift +++ b/ListableUI/Sources/ListProperties.swift @@ -148,10 +148,10 @@ public struct ListProperties // MARK: Initialization // - public typealias Build = (inout ListProperties) -> () + public typealias Configure = (inout ListProperties) -> () /// An instance of `ListProperties` with sensible default values. - public static func `default`(with builder : Build = { _ in }) -> Self { + public static func `default`(with configure : Configure = { _ in }) -> Self { Self( animatesChanges: UIView.inheritedAnimationDuration > 0.0, layout: .table(), @@ -161,7 +161,7 @@ public struct ListProperties autoScrollAction: .none, accessibilityIdentifier: nil, debuggingIdentifier: nil, - build: builder + configure: configure ) } @@ -175,7 +175,7 @@ public struct ListProperties autoScrollAction : AutoScrollAction, accessibilityIdentifier: String?, debuggingIdentifier: String?, - build : Build + configure : Configure ) { self.animatesChanges = animatesChanges self.layout = layout @@ -191,7 +191,7 @@ public struct ListProperties self.stateObserver = ListStateObserver() - build(&self) + configure(&self) } // @@ -199,14 +199,14 @@ public struct ListProperties // /// Updates the `ListProperties` object with the changes in the provided builder. - public mutating func modify(using builder : Build) { - builder(&self) + public mutating func modify(using configure : Configure) { + configure(&self) } /// Creates a new `ListProperties` object modified by the changes in the provided builder. - public func modified(using builder : Build) -> ListProperties { + public func modified(using configure : Configure) -> ListProperties { var copy = self - builder(©) + configure(©) return copy } diff --git a/ListableUI/Sources/ListView/ListSizing.swift b/ListableUI/Sources/ListView/ListSizing.swift index 5f6b45e64..02e1679e0 100644 --- a/ListableUI/Sources/ListView/ListSizing.swift +++ b/ListableUI/Sources/ListView/ListSizing.swift @@ -69,7 +69,7 @@ extension ListView // MARK: Measuring Lists // - public static func contentSize(in fittingSize : CGSize, for properties : ListProperties.Build) -> CGSize { + public static func contentSize(in fittingSize : CGSize, for properties : ListProperties.Configure) -> CGSize { self.contentSize(in: fittingSize, for: .default(with: properties)) } diff --git a/ListableUI/Sources/ListView/ListView.swift b/ListableUI/Sources/ListView/ListView.swift index 38b5c53bf..92298f3db 100644 --- a/ListableUI/Sources/ListView/ListView.swift +++ b/ListableUI/Sources/ListView/ListView.swift @@ -558,7 +558,7 @@ public final class ListView : UIView, KeyboardObserverDelegate }) } - public func configure(with builder : ListProperties.Build) + public func configure(with configure : ListProperties.Configure) { let description = ListProperties( animatesChanges: true, @@ -569,7 +569,7 @@ public final class ListView : UIView, KeyboardObserverDelegate autoScrollAction: self.autoScrollAction, accessibilityIdentifier: self.collectionView.accessibilityIdentifier, debuggingIdentifier: self.debuggingIdentifier, - build: builder + configure: configure ) self.configure(with: description) diff --git a/ListableUI/Sources/ListViewSource.swift b/ListableUI/Sources/ListViewSource.swift index cc49e2e00..a47c7b94b 100644 --- a/ListableUI/Sources/ListViewSource.swift +++ b/ListableUI/Sources/ListViewSource.swift @@ -165,7 +165,7 @@ public final class StaticSource : ListViewSource self.content = content } - public convenience init(with builder : Content.Build) + public convenience init(with builder : Content.Configure) { self.init(with: Content(with: builder)) }