Skip to content

Instantly share code, notes, and snippets.

View zntfdr's full-sized avatar
🌙
BRB GOING TO THE MOON

Federico Zanetello zntfdr

🌙
BRB GOING TO THE MOON
View GitHub Profile
// "Fix" for Xcode 12.5 SwiftUI navigation issue.
import SwiftUI
enum ContentViewNavigation: Identifiable {
case one
case two(number: Int)
case three(text: String)
// MARK: Identifiable
@zntfdr
zntfdr / CustomPicker.swift
Created March 27, 2021 04:37 — forked from apptekstudios/CustomPicker.swift
A variation on the picker designed by Federico Zanetello in his blog post (https://fivestars.blog/swiftui/inspecting-views.html) that allows any type of content to be used
//
// CustomPicker.swift
//
// Created by T Brennan on 27/3/21.
//
import SwiftUI
struct ContentView: View {
@State private var selection: Int? = 0
// 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 }
// 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
// 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 {
@zntfdr
zntfdr / actionTabBarItem.swift
Created May 13, 2020 11:31 — forked from lorenzofiamingo/actionTabBarItem.swift
An implementation for making tab bar item action
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
import SwiftUI
class AppState: ObservableObject {
@Published var screenAState: Bool = false
@Published var screenBState: Bool = false
}
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
@zntfdr
zntfdr / rainbowSystemColors.swift
Last active November 14, 2019 10:33
A Playground showcasing all the iOS 13 system colors
//
// System Colors Playground
// fivestars.blog
//
// Created by Federico Zanetello on 9/6/19.
//
import UIKit
import PlaygroundSupport
//
// System Materials Playground
// fivestars.blog
//
// Created by Federico Zanetello on 9/6/19.
//
import UIKit
import PlaygroundSupport
@zntfdr
zntfdr / grayscaleSystemColors.swift
Last active June 18, 2019 04:10
A Playground showcasing the iOS 13 system colors grayscale
//
// System Colors Playground
// fivestars.blog
//
// Created by Federico Zanetello on 9/6/19.
//
import UIKit
import PlaygroundSupport