Skip to content

Commit

Permalink
Merge pull request #262 from kyleve/kve/build-to-configure
Browse files Browse the repository at this point in the history
Replace build with configure as parameter name.
  • Loading branch information
kyleve authored Jan 26, 2021
2 parents c4c1795 + 581a983 commit 4ad8474
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 32 deletions.
4 changes: 2 additions & 2 deletions BlueprintUILists/Sources/HeaderFooter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extension HeaderFooter
backgroundProvider: background,
pressedBackgroundProvider: pressedBackground
),
build: configure
configure: configure
)
}

Expand Down Expand Up @@ -113,7 +113,7 @@ extension HeaderFooter
backgroundProvider: background,
pressedBackgroundProvider: pressedBackground
),
build: configure
configure: configure
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions BlueprintUILists/Sources/Item.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ extension Item
backgroundProvider: background,
selectedBackgroundProvider: selectedBackground
),
build: configure
configure: configure
)
}

Expand Down Expand Up @@ -123,7 +123,7 @@ extension Item
backgroundProvider: background,
selectedBackgroundProvider: selectedBackground
),
build: configure
configure: configure
)
}
}
Expand Down
4 changes: 2 additions & 2 deletions BlueprintUILists/Sources/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

//
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ListableUI/Sources/Content.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions ListableUI/Sources/EmbeddedList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ public extension Item where Content == EmbeddedList
static func list<Identifier:Hashable>(
_ identifier : Identifier,
sizing : EmbeddedList.Sizing,
build : ListProperties.Build
configure : ListProperties.Configure
) -> Item<EmbeddedList>
{
Item(
EmbeddedList(identifier: identifier, build: build),
EmbeddedList(identifier: identifier, configure: configure),

sizing: sizing.toStandardSizing,

Expand Down Expand Up @@ -68,7 +68,7 @@ public struct EmbeddedList : ItemContent
// MARK: Initialization
//

public init<Identifier:Hashable>(identifier : Identifier, build : ListProperties.Build)
public init<Identifier:Hashable>(identifier : Identifier, configure : ListProperties.Configure)
{
self.contentIdentifier = AnyHashable(identifier)

Expand All @@ -83,7 +83,7 @@ public struct EmbeddedList : ItemContent
autoScrollAction: .none,
accessibilityIdentifier: nil,
debuggingIdentifier: nil,
build: build
configure: configure
)
}

Expand Down
6 changes: 3 additions & 3 deletions ListableUI/Sources/HeaderFooter/HeaderFooter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public struct HeaderFooter<Content:HeaderFooterContent> : 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(
Expand Down
6 changes: 3 additions & 3 deletions ListableUI/Sources/Item/Item.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public struct Item<Content:ItemContent> : 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(
Expand Down
18 changes: 9 additions & 9 deletions ListableUI/Sources/ListProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -161,7 +161,7 @@ public struct ListProperties
autoScrollAction: .none,
accessibilityIdentifier: nil,
debuggingIdentifier: nil,
build: builder
configure: configure
)
}

Expand All @@ -175,7 +175,7 @@ public struct ListProperties
autoScrollAction : AutoScrollAction,
accessibilityIdentifier: String?,
debuggingIdentifier: String?,
build : Build
configure : Configure
) {
self.animatesChanges = animatesChanges
self.layout = layout
Expand All @@ -191,22 +191,22 @@ public struct ListProperties

self.stateObserver = ListStateObserver()

build(&self)
configure(&self)
}

//
// MARK: Mutating Content
//

/// 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(&copy)
configure(&copy)
return copy
}

Expand Down
2 changes: 1 addition & 1 deletion ListableUI/Sources/ListView/ListSizing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
4 changes: 2 additions & 2 deletions ListableUI/Sources/ListView/ListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ListableUI/Sources/ListViewSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 4ad8474

Please sign in to comment.