-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Source api documentation #28
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
57bc59f
Add source api documentation
mikolasstuchlik 96163ae
Documentation page without data flows
mikolasstuchlik 490f657
Apply suggestions from code review
mikolasstuchlik c405513
Apply Code Review suggestion
mikolasstuchlik 2f4587f
Merge branch 'feature/version-1-documentation' into f/v1d
mikolasstuchlik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
24 changes: 24 additions & 0 deletions
24
Sources/FuturedArchitecture/Architecture/ComponentModel.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 |
---|---|---|
@@ -1,7 +1,31 @@ | ||
import Foundation | ||
|
||
/// `ComponentModel` is an analogy to `ViewModel`. Each *component model* should have | ||
/// it's own protocol which uses the `ComponentModel` protocol as it's requirement. This allows us | ||
/// to create a Mock implementations of component models and allow for simpler and more scalable | ||
/// SwiftUI Previews. | ||
/// | ||
/// As is eluded to by `ComponentModel`, each component model has two main competencies: | ||
/// - Hold and organize data required by the associated view. | ||
/// - Receive events from the associated view and propagate them upwards to a *coordinator.* | ||
/// | ||
/// The associated type `Event` is just an `enum` in most cases, but we do not explicitly discourage | ||
/// you from using *any* type you see fit. However, keep in mind, that we should not burden *coordinators* | ||
/// with too much logic. Keep the API for the *coordinators* simple. | ||
/// | ||
/// - Note: Each *component model* should have have *mock* class and *implementation* class. | ||
/// Each *Component* (i.e. View) should have own *component model*. Each instance of component | ||
/// model has to be referenced by no more than 1 *coordinator.* | ||
public protocol ComponentModel: ObservableObject { | ||
|
||
/// Type used to pass events to the *coordinator*. `enum` is used in most cases, but not required. | ||
associatedtype Event | ||
|
||
/// Closure which should be provided by the *coordinator* and only invoked from within the | ||
/// *component model* instance. | ||
/// | ||
/// The return type if this closure is `Void` intentionally. If bidirectional communication is | ||
/// desired, either pass closure to the *coordinator* using the event, or use other | ||
/// recommended pattern of data flow. | ||
var onEvent: (Event) -> Void { get } | ||
} |
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
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
6 changes: 6 additions & 0 deletions
6
Sources/FuturedArchitecture/Architecture/NavigationStackFlow.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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather use
data state
instead ofapplication state
. Application state is often more than just a data state. Could be navigation state as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the work
application
instead.