-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support functional programming
- Loading branch information
Showing
5 changed files
with
65 additions
and
17 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
28 changes: 28 additions & 0 deletions
28
Sources/SwiftUINavigator/UIViewController+/UIViewController+functional.swift
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,28 @@ | ||
// | ||
// UIViewController+functional.swift | ||
// | ||
// | ||
// Created by 김인섭 on 10/15/23. | ||
// | ||
|
||
#if canImport(UIKit) | ||
import UIKit | ||
|
||
public extension UIViewController { | ||
|
||
func title(_ title: String?) -> Self { | ||
self.title = title | ||
return self | ||
} | ||
|
||
func hidesBottomBarWhenPushed(_ state: Bool) -> Self { | ||
self.hidesBottomBarWhenPushed = state | ||
return self | ||
} | ||
|
||
func backgroundColor(_ color: UIColor?) -> Self { | ||
self.view.backgroundColor = color | ||
return self | ||
} | ||
} | ||
#endif |
26 changes: 26 additions & 0 deletions
26
Sources/SwiftUINavigator/UIViewController+/UIViewController+indentifier.swift
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,26 @@ | ||
// | ||
// UIViewController+indentifier.swift | ||
// | ||
// | ||
// Created by 김인섭 on 10/15/23. | ||
// | ||
|
||
#if canImport(UIKit) | ||
import UIKit | ||
|
||
public extension UIViewController { | ||
|
||
private struct AssociatedKeys { | ||
static var identifier = "Identifier" | ||
} | ||
|
||
var identifier: String? { | ||
get { | ||
objc_getAssociatedObject(self, &AssociatedKeys.identifier) as? String | ||
} | ||
set { | ||
objc_setAssociatedObject(self, &AssociatedKeys.identifier, newValue, .OBJC_ASSOCIATION_RETAIN) | ||
} | ||
} | ||
} | ||
#endif |
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