-
Notifications
You must be signed in to change notification settings - Fork 118
Modernize app example #231
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
Conversation
|
Can one of the admins verify this patch? |
6 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
8a1e613 to
0ebb9dd
Compare
|
thank @stevapple ! lets get #228 in first |
|
@swift-server-bot test this please |
...calDebugging/MyApp/MyApp.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Outdated
Show resolved
Hide resolved
Examples/LocalDebugging/MyApp/MyApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Outdated
Show resolved
Hide resolved
0ebb9dd to
61a8a2d
Compare
61a8a2d to
dc491d5
Compare
|
I've rebased the branch against #228, so there should be no pain to merge. |
|
@swift-server-bot test this please |
57ba0f5 to
6bf66f6
Compare
6bf66f6 to
2b48c13
Compare
|
@swift-server-bot test this please |
|
|
||
| guard let httpResponse = response as? HTTPURLResponse else { | ||
| throw CommunicationError(reason: "invalid response, expected HTTPURLResponse") | ||
| return "invalid response, expected HTTPURLResponse" |
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'm personally not a big fan of removing the CommunicationError here, since it hides what actually happens. We need to have some do {} catch {} somewhere else. This method should be async throws -> String.
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.
Uh yes.
I changed it into () async -> String because we need to ensure the label is changed in every path. throws could be preserved here and it doesn't affect.
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 prefer something like this:
func register() await -> String {
do {
return try await self.runNetworkRegister(name: self.name, password: self.password)
} catch as CommunicationError {
return error.reason
} catch {
return error.localizedDescription
}
}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 suggest we catch in the button action? The register() API is expected not to confuse an actual response and a thrown Error. runNetworkRegister(name:password:) looks redundant here.
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.
Conditional catch can also be eliminated here by implementing LocalizedError.
f39d76f to
3c8345f
Compare
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.
Let's wait for @tomerd approval!
|
@tomerd ping |
|
@swift-server-bot test this please |
|
Xcode 13.2 and Swift Playgrounds 4 supports a new type of package-based app project ( I’m wondering if such change is too aggressive as most of us still use |
|
ping @tomerd @fabianfett |
Update
LocalDebuggingexample to reflect the latest SwiftUI practice.Motivation:
Since we already required Swift 5.5 with Concurrency (Xcode 13), it's natural to update the app part to reflect latest SwiftUI changes, which makes the code neater and more expressive.
Modifications:
LocalDebugging/MyAppto use SwiftUI lifecycle;LocalDebugging/MyAppto reflect SwiftUI best practice;LocalDebugging/Sharedto use Swift 5.5.Result:
A better demo app.