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
AWSTemplateFormatVersion: '2010-09-09' | |
Description: Cognito Stack | |
Parameters: | |
AuthName: | |
Type: String | |
Description: Unique Auth Name for Cognito Resources | |
Resources: | |
# Creates a role that allows Cognito to send SNS messages | |
SNSRole: |
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
.... | |
// inside any view use it like this | |
Button { | |
sessionObject.createErrorModal(image: "some-random-image", title: "Wops 😅 Something doesn't look right. Try again!", subTitle: "Soemthing went worng sending this message. Check your internet connection and try again", buttonTitle: "Try again") | |
} label: { | |
Text("Press Me to show popup") | |
} |
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
struct AppEntry: View { | |
@EnvironmentObject var sessionObject: SessionObject | |
var body: some View { | |
ZStack { | |
SomeOtherStartupView() | |
// this is a @ViewBuilder that we're creating later | |
globalModals() | |
} | |
} |
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
struct GenericErrorView: View { | |
var image: String = "some-image-from-assets" | |
var title: String = "Title" | |
var subtitle: String = "Subtitle" | |
var buttonTitle: String = "ok" | |
var action: (() -> Void)? | |
var body: some View { |
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
struct AppEntry: View { | |
@EnvironmentObject var sessionObject: SessionObject | |
var body: some View { | |
ZStack { | |
SomeOtherStartupView() | |
// this is a @ViewBuilder that we're creating later | |
globalModals() | |
} | |
} |
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
class sessionObject: ObservableObject { | |
.... | |
public func createErrorModal(image: String, title: String, subTitle: String, buttonTitle: String) { | |
self.image = image | |
self.title = title | |
self.subtitle = subTitle | |
self.buttonTitle = buttonTitle |
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
class SessionObject: ObservableObject { | |
// global modal content | |
@Published var isGlobalError: Bool = false | |
@Published var isGlobalPopup: Bool = false | |
@Published var image: String = "" | |
@Published var title: String = "" | |
@Published var subtitle: String = "" | |
@Published var buttonTitle: String = "" |
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
// | |
// Author: Chase Wasden | |
// Website: https://gist.github.com/ccwasden | |
// Licensed under MIT license https://opensource.org/licenses/MIT | |
// | |
import SwiftUI | |
struct Fruit: Selectable { | |
let name: String |
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
// | |
// Author: Chase Wasden | |
// Website: https://gist.github.com/ccwasden | |
// Licensed under MIT license https://opensource.org/licenses/MIT | |
// | |
import SwiftUI | |
struct Fruit: Selectable { | |
let name: String |