Skip to content

Commit

Permalink
Add optional section footer title to MockPageTemplate (#101)
Browse files Browse the repository at this point in the history
* Add optional section footer title to MockPageTemplate

* Delete launch.json
  • Loading branch information
ivan-pratama authored Oct 11, 2023
1 parent 75f4890 commit e7bed17
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions Sources/RxComposableArchitecture/Debugging/MockPageTemplate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

/**
Use this template to help you create a list of behaviour on your `Example`, and also used it on MainApp's `BootstrapPicker`.
Here is an example, i create new VC named `MockViewController` to be used on `Example` and MainApp's `BootstrapPicker`.
Here is an example, I created a new VC named `MockViewController` to be used on `Example` and MainApp's `BootstrapPicker`.
## Example
```swift
Expand All @@ -31,7 +31,8 @@
var sections = [
Section(
title: "Mock",
mocks: [mockNoInternet, ...]
mocks: [mockNoInternet, ...],
footerTitle: "This section contains network-related mocks."
),
...
]
Expand Down Expand Up @@ -68,10 +69,12 @@
public struct Section {
public let title: String
public let mocks: [Mock]
public let footerTitle: String?

public init(title: String, mocks: [Mock]) {
public init(title: String, mocks: [Mock], footerTitle: String? = nil) {
self.title = title
self.mocks = mocks
self.footerTitle = footerTitle
}
}

Expand Down Expand Up @@ -219,6 +222,10 @@
override open func tableView(_: UITableView, titleForHeaderInSection section: Int) -> String? {
filteredSections[section].title
}

override open func tableView(_: UITableView, titleForFooterInSection section: Int) -> String? {
filteredSections[section].footerTitle
}
}

extension MockPageTemplate: UISearchBarDelegate {
Expand Down

0 comments on commit e7bed17

Please sign in to comment.