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
import UIKit | |
import Combine | |
// MADE UP CODE | |
typealias Package = Int | |
struct Offerings { | |
var monthtly: Package? | |
var annual: Package? | |
var lifetime: Package? |
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
// | |
// HelloAnimationView.swift | |
// SwiftUIBiteSize | |
// | |
// Created by Dan Tavares on 29/06/2022. | |
// | |
import SwiftUI | |
struct HelloAnimationView: 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
@propertyWrapper | |
struct AnimatedState<Value> : DynamicProperty { | |
let storage: State<Value> | |
let animation: Animation? | |
init( | |
value: Value, | |
animation: Animation? = nil | |
) { | |
self.storage = State<Value>(initialValue: value) |
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
// | |
// main.swift | |
// PreviewDeviceExporter | |
// | |
// Created by Dan Tavares on 13/05/2021. | |
// https://github.com/JohnSundell/Files | |
// https://github.com/JohnSundell/ShellOut.git | |
// Packages used |
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 ToggledExampleView_Previews: PreviewProvider { | |
static var previews: some View { | |
DebuggingToggledExampleView() | |
} | |
} | |
// MARK: - Toggled Source | |
protocol ToggleInterface { | |
associatedtype ValueType |
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
// | |
// Created by Daniel Tavares on 07/05/2021. | |
// | |
import SwiftUI | |
// MARK: - OptionsSet | |
// Blog post https://dev.to/vibrazy/easy-swiftui-view-bindings-using-optionset-and-sourcery-4edb | |
protocol OptionsBinding {} |
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
// | |
// ContentView.swift | |
// Shared | |
// | |
// Created by Dan Tavares on 01/07/2022. | |
// More Info: https://nilcoalescing.com/blog/EncodeAndDecodeSwiftUIColor/ | |
import SwiftUI | |
#if os(iOS) |
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
// | |
// TilingTabView.swift | |
// | |
// | |
// Created by Dan Tavares on 12/07/2020. | |
// | |
import SwiftUI | |
class State: ObservableObject { |
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
// | |
// Created by Dan Tavares on 10/07/2020. | |
// | |
import SwiftUI | |
struct WindowKey: EnvironmentKey { | |
static let defaultValue: UIWindow? = { | |
guard | |
let firstScene = UIApplication.shared.connectedScenes.first, |
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
var userPreferences: [String]? = [""] | |
/// Type safe method to check if collection is nil and if not if it has values | |
func nilOrEmptyCollection<Collection where Collection: CollectionType>(collection: Collection?) -> Bool { | |
guard let collection = collection else { return true } | |
return collection.isEmpty | |
} | |
/// Extension on Options with constraint to collection type | |
extension Optional where Wrapped: CollectionType { |
NewerOlder