Skip to content

Instantly share code, notes, and snippets.

@purpleblues
purpleblues / main.m
Created February 26, 2025 08:01 — forked from larussverris/main.m
Creating an aggregate device using Core Audio in Objective-C
#import <Foundation/Foundation.h>
#import <CoreAudio/CoreAudio.h>
#import "utilities.h"
/*
This example demonstrates how to create an aggregate device using Core Audio in Objective-C.
It creates an aggregate device with two sub-devices, which are the default input and output devices.
*/
int main(int argc, const char * argv[]) {
@purpleblues
purpleblues / README.md
Created July 27, 2022 09:12 — forked from IsaacXen/README.md
(Almost) Every WWDC videos download links for aria2c.
// Similar to defer in Swift
#define pspdf_defer_block_name_with_prefix(prefix, suffix) prefix ## suffix
#define pspdf_defer_block_name(suffix) pspdf_defer_block_name_with_prefix(pspdf_defer_, suffix)
#define pspdf_defer __strong void(^pspdf_defer_block_name(__LINE__))(void) __attribute__((cleanup(pspdf_defer_cleanup_block), unused)) = ^
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
static void pspdf_defer_cleanup_block(__strong void(^*block)(void)) {
(*block)();
}
#pragma clang diagnostic pop
@purpleblues
purpleblues / View.swift
Created April 4, 2021 14:44 — forked from steipete/View.swift
Accept dropping a file onto SwiftUI (both iOS and macOS)
.onDrop(of: [.fileURL], isTargeted: nil) { providers in
if let loadableProvider = providers.first(where: { $0.canLoadObject(ofClass: URL.self) }) {
_ = loadableProvider.loadObject(ofClass: URL.self) { fileURL, _ in
if let fileURL = fileURL, fileURL.pathExtension.lowercased() == "zip" {
self.logger.info("Dropped \(fileURL.path)")
DispatchQueue.main.async {
importer.open(zipArchiveURL: fileURL)
}
}
}