Skip to content

Commit 95b9f9a

Browse files
add examples to the docs
1 parent c661a60 commit 95b9f9a

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

Sources/ComponentsKit/Modal/UIKit/UKBottomModalController.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
import UIKit
22

33
/// A bottom-aligned modal controller.
4+
///
5+
/// - Example:
6+
/// ```swift
7+
/// let bottomModal = UKBottomModalController(
8+
/// model: BottomModalVM(),
9+
/// header: { _ in
10+
/// let headerLabel = UILabel()
11+
/// headerLabel.text = "Header"
12+
/// return headerLabel
13+
/// },
14+
/// body: { _ in
15+
/// let bodyLabel = UILabel()
16+
/// bodyLabel.text = "This is the body content of the modal."
17+
/// bodyLabel.numberOfLines = 0
18+
/// return bodyLabel
19+
/// },
20+
/// footer: { dismiss in
21+
/// return UKButton(model: .init {
22+
/// $0.title = "Close"
23+
/// }) {
24+
/// dismiss(true)
25+
/// }
26+
/// }
27+
/// )
28+
///
29+
/// vc.present(bottomModal, animated: true)
30+
/// ```
431
public class UKBottomModalController: UKModalController<BottomModalVM> {
532
// MARK: - Initialization
633

Sources/ComponentsKit/Modal/UIKit/UKCenterModalController.swift

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,33 @@
11
import UIKit
22

33
/// A center-aligned modal controller.
4+
///
5+
/// - Example:
6+
/// ```swift
7+
/// let centerModal = UKCenterModalController(
8+
/// model: CenterModalVM(),
9+
/// header: { _ in
10+
/// let headerLabel = UILabel()
11+
/// headerLabel.text = "Header"
12+
/// return headerLabel
13+
/// },
14+
/// body: { _ in
15+
/// let bodyLabel = UILabel()
16+
/// bodyLabel.text = "This is the body content of the modal."
17+
/// bodyLabel.numberOfLines = 0
18+
/// return bodyLabel
19+
/// },
20+
/// footer: { dismiss in
21+
/// return UKButton(model: .init {
22+
/// $0.title = "Close"
23+
/// }) {
24+
/// dismiss(true)
25+
/// }
26+
/// }
27+
/// )
28+
///
29+
/// vc.present(centerModal, animated: true)
30+
/// ```
431
public class UKCenterModalController: UKModalController<CenterModalVM> {
532
// MARK: - Initialization
633

0 commit comments

Comments
 (0)