Skip to content

Example code in README#8

Merged
Sajjon merged 3 commits into
mainfrom
example_polish
May 13, 2026
Merged

Example code in README#8
Sajjon merged 3 commits into
mainfrom
example_polish

Conversation

@Sajjon
Copy link
Copy Markdown
Owner

@Sajjon Sajjon commented May 13, 2026

readme example code

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md illustrating a Scene/View/ViewModel setup.
  • Reorganized SignUpViewModel in the SignUpDemo to move InputFromView/Output near 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 thread README.md
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 = { ... }()
}
Comment thread README.md
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()
}
@Sajjon Sajjon changed the title polish Example code in README May 13, 2026
@Sajjon Sajjon merged commit 800e483 into main May 13, 2026
2 checks passed
@Sajjon Sajjon deleted the example_polish branch May 13, 2026 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants