Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LeonidKokhnovich/c140d0dc14d56619ebf2abf82218aa5d to your computer and use it in GitHub Desktop.
Save LeonidKokhnovich/c140d0dc14d56619ebf2abf82218aa5d to your computer and use it in GitHub Desktop.
ReThinkingCoordinators-ViewControllersOnly
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