Skip to content

Instantly share code, notes, and snippets.

@grenos
grenos / cognito.yaml
Created July 25, 2021 21:17 — forked from singledigit/cognito.yaml
Create a Cognito Authentication Backend via CloudFormation
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:
@grenos
grenos / swiftui-medium-006.swift
Created February 24, 2021 09:57
swiftui-medium-006
....
// 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")
}
@grenos
grenos / swiftui-medium-005.swift
Last active February 24, 2021 09:51
swiftui-medium-005
struct AppEntry: View {
@EnvironmentObject var sessionObject: SessionObject
var body: some View {
ZStack {
SomeOtherStartupView()
// this is a @ViewBuilder that we're creating later
globalModals()
}
}
@grenos
grenos / swiftui-medium-004.swift
Last active February 24, 2021 09:43
swiftui-medium-004
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 {
@grenos
grenos / swiftui-medium-003.swift
Last active February 24, 2021 09:29
swiftui-medium-003
struct AppEntry: View {
@EnvironmentObject var sessionObject: SessionObject
var body: some View {
ZStack {
SomeOtherStartupView()
// this is a @ViewBuilder that we're creating later
globalModals()
}
}
@grenos
grenos / swiftui-medium-002.swift
Last active February 24, 2021 09:53
swiftui-medium-002
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
@grenos
grenos / swiftui-medium-001.swift
Last active February 24, 2021 09:53
swiftui-medium-001
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 = ""
@grenos
grenos / Multiselect2.swift
Created April 29, 2020 11:56 — forked from ccwasden/Multiselect2.swift
Swift multiselect
//
// 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
@grenos
grenos / Multiselect2.swift
Created April 29, 2020 11:56 — forked from ccwasden/Multiselect2.swift
Swift multiselect
//
// 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