Skip to content

Instantly share code, notes, and snippets.

View otaviokz's full-sized avatar

Otávio Zabaleta otaviokz

View GitHub Profile

Xcode-Shortcuts


1. Show Emojis

Command + Control + Space) 

(⌘ + ⌃ + -)
@otaviokz
otaviokz / csv-to-swift-decodable-json.py
Last active November 8, 2025 20:15
Python3 program that maps "input.csv" files to "output.json", output being a JSON file which is decodable to Swift structs. It also converts Snake Case keys to Camel Case ones so you don't have to waste your time writting CodingKey mappings.
#!/usr/bin/env python3
import csv
import json
import argparse
import re
from pathlib import Path
from typing import List, Optional, Dict, Any
from datetime import datetime, timezone
# ---- Date detection (for detection ONLY; we won't reformat) ----
@otaviokz
otaviokz / License
Created August 2, 2025 23:30
MIT License
MIT License
Copyright (c) 2021 Otavio Zabaleta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@otaviokz
otaviokz / BorderedViewModifier.swift
Last active November 8, 2025 20:14
A SwiftUI ViewModifier to add borders to views
//
// BorderedViewModifier.swift
//
// Created by Otavio Zabaleta on 02/08/25.
//
import SwiftUI
struct BorderedViewModifier: ViewModifier {
let color: Color
@otaviokz
otaviokz / ScreenOrientationModifiers.swift
Last active August 2, 2025 23:33
2 SwiftUI ViewModifiers that keep track of a device's Screen Orientation
import UIKit
import SwiftUI
@available(iOS 17.0, *)
struct DeviceOrientationModifier: ViewModifier {
@Binding var interfaceOrientation: UIDeviceOrientation
func body(content: Content) -> some View {
GeometryReader { geometry in
content