Skip to content

Instantly share code, notes, and snippets.

View seanlilmateus's full-sized avatar

Mateus seanlilmateus

View GitHub Profile
@chockenberry
chockenberry / PrivacyInfo.xcprivacy
Last active April 19, 2024 18:39
PrivacyInfo.xcprivacy sample
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
//
// VolumePopupView.swift
//
// Created by Alex Rosenberg on 1/24/24.
//
import SwiftUI
import AVFoundation
import MediaPlayer
@swiftui-lab
swiftui-lab / anim-part6.swift
Last active March 28, 2024 08:20
Examples for SwiftUI Blog Post (Advanced SwiftUI Animations - Part 6)
// Author: SwiftUI-Lab (swiftui-lab.com)
// Description: Advanced SwiftUI Animations - Part 6 Examples
// blog article: https://swiftui-lab.com/swiftui-animations-part6
import SwiftUI
struct ContentView: View {
@State var show: Int? = nil
var body: some View {
@helje5
helje5 / SwiftUIDataUnitTest.swift
Created August 17, 2023 16:19
Unit Testing a SwiftUI Query
//
// Created by Helge Heß.
// Copyright © 2023 ZeeZide GmbH.
//
import XCTest
import UIKit
import SwiftData
import SwiftUI
@christianselig
christianselig / widget-center-async-await.swift
Created August 10, 2023 23:39
Adds async await support to WidgetCenter configuration fetch
import WidgetKit
extension WidgetCenter {
func currentConfigurations() async throws -> [WidgetInfo] {
try await withCheckedThrowingContinuation { continuation in
getCurrentConfigurations { result in
continuation.resume(with: result)
}
}
}
@collindonnell
collindonnell / multichat.rb
Created July 15, 2023 02:42
Simple Ruby TCP multi-user chat room
#!/usr/bin/env ruby
# frozen_string_literal: true
require "socket"
class Connection
def initialize(client:, server:)
@client = client
@server = server
end
@ole
ole / RelativeSizeLayout.swift
Last active March 24, 2024 22:24
A SwiftUI layout and modifier for working with relative sizes ("50 % of your container"). https://oleb.net/2023/swiftui-relative-size/
import SwiftUI
extension View {
/// Proposes a percentage of its received proposed size to `self`.
///
/// This modifier multiplies the proposed size it receives from its parent
/// with the given factors for width and height.
///
/// If the parent proposes `nil` or `.infinity` to us in any dimension,
/// we’ll forward these values to our child view unchanged.
@ole
ole / set-photos-keyboard-shortcuts.sh
Last active January 29, 2024 08:30
Assign a keyboard shortcut to the Export Unmodified Originals menu command in Photos.app on macOS
#!/bin/bash
# Assigns a keyboard shortcut to the Export Unmodified Originals
# menu command in Photos.app on macOS.
# @ = Command
# ^ = Control
# ~ = Option
# $ = Shift
shortcut='@~^e'
@stephancasas
stephancasas / AdvancedToolbarWindow.swift
Last active March 18, 2024 14:20
A SwiftUI-compatible window for macOS with advanced toolbar configurability.
//
// AdvancedToolbarWindow.swift
//
// Created by Stephan Casas on 3/17/23.
//
import SwiftUI;
import AppKit;
class AdvancedToolbarWindow<MainContent: View, ToolbarContent: View, TitleToolbarContent: View>: NSWindow, NSToolbarDelegate {
//
// ContentView.swift
// AppleMusicLyricsPlayer
//
// Created by Magesh Sridhar on 2/5/23.
//
import SwiftUI
import AVKit