Skip to content

Instantly share code, notes, and snippets.

Avatar
🌙
BRB GOING TO THE MOON

Federico Zanetello zntfdr

🌙
BRB GOING TO THE MOON
View GitHub Profile
@zntfdr
zntfdr / CustomPicker.swift
Created Mar 27, 2021 — 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
View CustomPicker.swift
//
// CustomPicker.swift
//
// Created by T Brennan on 27/3/21.
//
import SwiftUI
struct ContentView: View {
@State private var selection: Int? = 0
@zntfdr
zntfdr / invocation.sh
Created Jul 19, 2020 — forked from ole/!swiftui-reflection-dump.md
A dump of the SwiftUI.framework binary for the iOS simulator (as of Xcode 12.0 beta 2) using the swift-reflection-dump tool.
View invocation.sh
# Call this inside the bin directory of a build of the Swift compiler,
# e.g. build/Xcode-ReleaseAssert/swift-macosx-x86_64/Release/bin.
#
# Adjust the path to match your Xode installation or pick a different binary to dump.
#
# Tested with Xcode 12.0 beta 2.
#
# Note: I used a Swift 5.3 compiler build from a few weeks ago that I had laying around.
# Because of ABI stability, I don't think the swift-reflection-dump version has to match
# the compiler version that was used to build the binary, but I'm not 100% sure.
@zntfdr
zntfdr / actionTabBarItem.swift
Created May 13, 2020 — forked from lorenzofiamingo/actionTabBarItem.swift
An implementation for making tab bar item action
View actionTabBarItem.swift
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
@zntfdr
zntfdr / clean_localizable.swift
Created Sep 21, 2018 — forked from ginowu7/clean_localizable.swift
Clean swift localizable script
View clean_localizable.swift
/// Throws error if ALL localizable files does not have matching keys
///
/// - Parameter files: list of localizable files to validate
func validateMatchKeys(_ files: [LocalizationStringsFile]) {
print("------------ Validating keys match in all localizable files ------------")
guard let base = files.first, files.count > 1 else { return }
let files = Array(files.dropFirst())
files.forEach {
guard let extraKey = Set(base.keys).symmetricDifference($0.keys).first else { return }
let incorrectFile = $0.keys.contains(extraKey) ? $0 : base