Last active
January 27, 2022 07:05
-
-
Save LeonidKokhnovich/c140d0dc14d56619ebf2abf82218aa5d to your computer and use it in GitHub Desktop.
ReThinkingCoordinators-ViewControllersOnly
This file contains hidden or 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
class NewsfeedViewController: UIViewController { | |
// … | |
func onCreateNewPostOptionSelected() { | |
// #1 | |
let createNewPostVC = CreateNewPostViewController() | |
self.present(createNewPostVC, animated: true, completion: nil) | |
} | |
// … | |
} | |
// … | |
class CreateNewPostViewController: UIViewController { | |
// Declare some default content settings | |
var contentSettings = PostContentSettings(expiryDate: nil, isPublic: true) | |
// … | |
func onEditPostContentSettings() { | |
// #2 | |
let editPostContentSettingsVC = EditPostContentSettingsViewController() | |
editPostContentSettingsVC.contentSettings = contentSettings | |
self.navigationController?.present(editPostContentSettingsVC, animated: true, completion: nil) | |
} | |
// … | |
} | |
// … | |
class PostContentSettings { | |
var expiryDate: Date? | |
var isPublic: Bool | |
init(expiryDate: Date?, isPublic: Bool) { | |
self.expiryDate = expiryDate | |
self.isPublic = isPublic | |
} | |
} | |
class EditPostContentSettingsViewController: UIViewController { | |
// … | |
var contentSettings: PostContentSettings? | |
// … | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment