-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from 3sidedcube/feature/declarative-section
Create `DeclarativeSection` and override header/footer methods in `TableViewController` for when the section is `DeclarativeSection`
- Loading branch information
Showing
3 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// DeclarativeSection.swift | ||
// ThunderTable | ||
// | ||
// Created by Ben Shutt on 01/02/2021. | ||
// Copyright © 2021 3SidedCube. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
/// A `TableSection` with a header and footer specified | ||
open class DeclarativeSection: TableSection { | ||
|
||
/// `CGFloat` height of the header for `Section` | ||
open var headerHeight: CGFloat | ||
|
||
/// `UIView` view of the header for `Section` | ||
open var headerView: UIView | ||
|
||
/// `CGFloat` height of the footer for `Section` | ||
open var footerHeight: CGFloat | ||
|
||
/// `UIView` view of the footer for `Section` | ||
open var footerView: UIView | ||
|
||
/// Default memberwise initializer | ||
/// | ||
/// - Parameters: | ||
/// - rows: `[Row]` | ||
/// - headerHeight: `CGFloat` | ||
/// - headerView: `UIView` | ||
/// - footerHeight: `CGFloat` | ||
/// - footerView: `UIView` | ||
public init( | ||
rows: [Row], | ||
headerHeight: CGFloat = 0, | ||
headerView: UIView = UIView(), | ||
footerHeight: CGFloat = 0, | ||
footerView: UIView = UIView() | ||
) { | ||
self.headerHeight = headerHeight | ||
self.headerView = headerView | ||
self.footerHeight = footerHeight | ||
self.footerView = footerView | ||
|
||
super.init(rows: rows) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters