-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from johnpatrickmorgan/feature/new-features
Add new 0.1 features
- Loading branch information
Showing
31 changed files
with
1,981 additions
and
773 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"fileScopedDeclarationPrivacy" : { | ||
"accessLevel" : "private" | ||
}, | ||
"indentation" : { | ||
"spaces" : 2 | ||
}, | ||
"indentConditionalCompilationBlocks" : true, | ||
"indentSwitchCaseLabels" : false, | ||
"lineBreakAroundMultilineExpressionChainComponents" : false, | ||
"lineBreakBeforeControlFlowKeywords" : false, | ||
"lineBreakBeforeEachArgument" : false, | ||
"lineBreakBeforeEachGenericRequirement" : false, | ||
"lineLength" : 100, | ||
"maximumBlankLines" : 1, | ||
"prioritizeKeepingFunctionOutputTogether" : false, | ||
"respectsExistingLineBreaks" : true, | ||
"rules" : { | ||
"AllPublicDeclarationsHaveDocumentation" : false, | ||
"AlwaysUseLowerCamelCase" : true, | ||
"AmbiguousTrailingClosureOverload" : true, | ||
"BeginDocumentationCommentWithOneLineSummary" : false, | ||
"DoNotUseSemicolons" : true, | ||
"DontRepeatTypeInStaticProperties" : true, | ||
"FileScopedDeclarationPrivacy" : true, | ||
"FullyIndirectEnum" : true, | ||
"GroupNumericLiterals" : true, | ||
"IdentifiersMustBeASCII" : true, | ||
"NeverForceUnwrap" : false, | ||
"NeverUseForceTry" : false, | ||
"NeverUseImplicitlyUnwrappedOptionals" : false, | ||
"NoAccessLevelOnExtensionDeclaration" : false, | ||
"NoBlockComments" : true, | ||
"NoCasesWithOnlyFallthrough" : true, | ||
"NoEmptyTrailingClosureParentheses" : true, | ||
"NoLabelsInCasePatterns" : true, | ||
"NoLeadingUnderscores" : false, | ||
"NoParensAroundConditions" : true, | ||
"NoVoidReturnOnFunctionSignature" : true, | ||
"OneCasePerLine" : true, | ||
"OneVariableDeclarationPerLine" : true, | ||
"OnlyOneTrailingClosureArgument" : true, | ||
"OrderedImports" : false, | ||
"ReturnVoidInsteadOfEmptyTuple" : true, | ||
"UseLetInEveryBoundCaseVariable" : true, | ||
"UseShorthandTypeNames" : true, | ||
"UseSingleLinePropertyGetter" : true, | ||
"UseSynthesizedInitializer" : true, | ||
"UseTripleSlashForDocumentationComments" : true, | ||
"ValidateDocumentationComments" : false | ||
}, | ||
"tabWidth" : 8, | ||
"version" : 1 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import Foundation | ||
import SwiftUI | ||
import FlowStacks | ||
import SwiftUINavigation | ||
|
||
struct BindingCoordinator: View { | ||
enum Screen { | ||
case start | ||
case number(Int) | ||
} | ||
|
||
@State var routes: Routes<Screen> = [.root(.start, embedInNavigationView: true)] | ||
|
||
var body: some View { | ||
Router($routes) { $screen, _ in | ||
if let number = Binding(unwrapping: $screen, case: /Screen.number) { | ||
// Here number is a Binding<Int>, so NumberView can change its | ||
// value in the routes array. | ||
EditableNumberView(number: number) | ||
} else { | ||
StartView(goTapped: goTapped) | ||
} | ||
} | ||
} | ||
|
||
func goTapped() { | ||
routes.push(.number(42)) | ||
} | ||
} | ||
|
||
struct StartView: View { | ||
|
||
let goTapped: () -> Void | ||
|
||
var body: some View { | ||
VStack(alignment: .center, spacing: 8) { | ||
Button("Go", action: goTapped) | ||
}.navigationTitle("Home") | ||
} | ||
} | ||
|
||
struct EditableNumberView: View { | ||
|
||
@Binding var number: Int | ||
|
||
var body: some View { | ||
VStack(alignment: .center, spacing: 8) { | ||
Stepper("\(number)", onIncrement: { number += 1 }, onDecrement: { number -= 1 }) | ||
} | ||
.padding() | ||
.navigationTitle("\(number)") | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.