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
// | |
// CustomPicker.swift | |
// | |
// Created by T Brennan on 27/3/21. | |
// | |
import SwiftUI | |
struct ContentView: View { | |
@State private var selection: Int? = 0 |
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 article here: https://www.fivestars.blog/code/swiftui-hierarchy-list.html | |
import SwiftUI | |
struct FileItem: Identifiable { | |
let name: String | |
var children: [FileItem]? | |
var id: String { name } |
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 article here: https://www.fivestars.blog/swiftui/app-scene-storage.html | |
import Combine | |
import SwiftUI | |
// MARK: Appearance | |
enum Appearance: String, Codable, CaseIterable, Identifiable { | |
case dark | |
case light |
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 article here: https://www.fivestars.blog/code/redacted-custom-effects.html | |
import SwiftUI | |
extension RedactionReasons { | |
public static let confidential = RedactionReasons(rawValue: 1 << 10) | |
} | |
struct ContentView: View { | |
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 ContentView: View { | |
@State private var selection = 0 | |
private var actionSelection: Binding<Int> { | |
Binding<Int>(get: { | |
self.selection | |
}) { (newValue: Int) in | |
if newValue == 1 { | |
// put action here |
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 SwiftUI | |
class AppState: ObservableObject { | |
@Published var screenAState: Bool = false | |
@Published var screenBState: Bool = false | |
} | |
class SceneDelegate: UIResponder, UIWindowSceneDelegate { | |
var window: UIWindow? |
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
// | |
// System Colors Playground | |
// fivestars.blog | |
// | |
// Created by Federico Zanetello on 9/6/19. | |
// | |
import UIKit | |
import PlaygroundSupport |
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
// | |
// System Materials Playground | |
// fivestars.blog | |
// | |
// Created by Federico Zanetello on 9/6/19. | |
// | |
import UIKit | |
import PlaygroundSupport |
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
// | |
// System Colors Playground | |
// fivestars.blog | |
// | |
// Created by Federico Zanetello on 9/6/19. | |
// | |
import UIKit | |
import PlaygroundSupport |