Example code in README#8
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR polishes the repository’s documentation and example app by adding a “Show me code” walkthrough to the README and reorganizing the SignUpDemo SignUpViewModel to match the README-style structure.
Changes:
- Added a full “Show me code” Swift snippet to
README.mdillustrating a Scene/View/ViewModel setup. - Reorganized
SignUpViewModelin the SignUpDemo to moveInputFromView/Outputnear the top and tweak formatting/structure.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| README.md | Adds a large example code snippet demonstrating NanoViewController usage. |
| Examples/SignUpDemo/Sources/Onboarding/SignUpViewModel.swift | Reorders nested types/extensions and adjusts formatting for the demo ViewModel. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+13
to
+19
| // MARK: View | ||
| public final class SignUpView { | ||
| private lazy var nameField: UITextField = { ... }() | ||
| private lazy var emailField: UITextField = { ... }() | ||
| private lazy var submitButton: UIButton = { ... }() | ||
| private lazy var spinner: UIActivityIndicatorView = { ... }() | ||
| } |
| private let service: SignUpServicing | ||
| /* BaseViewModel declared `public let navigator = Navigator<NavigationStep>()` */ | ||
| /* BaseViewModel declared `public var cancellables = Set<AnyCancellable>()` */ | ||
|
|
Comment on lines
+17
to
+51
| /// User-event publishers the view streams in. | ||
| struct InputFromView { | ||
| public let name: AnyPublisher<String, Never> | ||
| public let email: AnyPublisher<String, Never> | ||
| public let submitTrigger: AnyPublisher<Void, Never> | ||
|
|
||
| public init( | ||
| name: AnyPublisher<String, Never>, | ||
| email: AnyPublisher<String, Never>, | ||
| submitTrigger: AnyPublisher<Void, Never> | ||
| ) { | ||
| self.name = name | ||
| self.email = email | ||
| self.submitTrigger = submitTrigger | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // MARK: Output | ||
| public extension SignUpViewModel { | ||
| /// Reactive bindings the view installs. | ||
| struct Output { | ||
| /// Drives the Sign Up button's `isEnabled` (`isFormValid && !isLoading`). | ||
| public let isSubmitEnabled: AnyPublisher<Bool, Never> | ||
|
|
||
| /// `true` while the sign-up service call is in flight. The view | ||
| /// reflects this on a `UIActivityIndicatorView` overlaid on the | ||
| /// submit button. | ||
| public let isLoading: AnyPublisher<Bool, Never> | ||
| } | ||
| } | ||
| public extension SignUpViewModel.Output { | ||
| var loadingText: AnyPublisher<String, Never> { | ||
| isLoading.map { $0 ? "" : "Sign Up" }.eraseToAnyPublisher() | ||
| } |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
readme example code