Skip to content

Commit

Permalink
Deprecate closure style render method
Browse files Browse the repository at this point in the history
  • Loading branch information
ra1028 committed Sep 4, 2019
1 parent f95c1b6 commit 34b9828
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions Sources/Renderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ open class Renderer<Updater: Carbon.Updater> {
///
/// - Parameters:
/// - buildData: A closure to build sections.
@available(*, deprecated, message: "This method will be removed next version owing to avoid ambiguity with new syntax using function builder.")
open func render(_ buildData: (inout [Section]) -> Void) {
var data = [Section]()
buildData(&data)
Expand Down
1 change: 1 addition & 0 deletions Sources/Section.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public struct Section {
/// - Parameters:
/// - id: An identifier to be wrapped.
/// - buildSection: A closure to build section.
@available(*, deprecated, message: "This method will be removed next version owing to avoid ambiguity with new syntax using function builder.")
@inlinable
public init<I: Hashable>(id: I, _ buildSection: (inout Section) -> Void) {
var section = Section(id: id)
Expand Down
1 change: 1 addition & 0 deletions Tests/RendererTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ final class RendererTests: XCTestCase {
XCTAssertEqual(renderer.updater.adapterCapturedOnUpdates, adapter)
}

@available(*, deprecated)
func testRenderWithBuilderClosure() {
let target = MockTarget()
let adapter = MockAdapter()
Expand Down
1 change: 1 addition & 0 deletions Tests/SectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ final class SectionTests: XCTestCase {
XCTAssertEqual(section.cells.count, 2)
}

@available(*, deprecated)
func testInitWithBuilderClosure() {
let section = Section(id: TestID.a) { section in
section.header = ViewNode(A.Component())
Expand Down

0 comments on commit 34b9828

Please sign in to comment.