Skip to content

Instantly share code, notes, and snippets.

//
// ViewController.m
// MyApp
//
// Created by Jinwoo Kim on 12/9/23.
//
#import "ViewController.h"
#import <objc/message.h>
//
// PHPickerConfiguration+OnlyReturnsIdentifiers.hpp
// SurfVideo
//
// Created by Jinwoo Kim on 12/6/23.
//
#import <PhotosUI/PhotosUI.h>
NS_ASSUME_NONNULL_BEGIN
import UIKit
import SwiftUI
fileprivate final class PresentedViewController: UIHostingController<AnyView> {
var key: UUID?
var willDisappear: (() -> Void)?
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
import SwiftUI
private let associationKey = UnsafeMutablePointer<UInt8>.allocate(capacity: 1)
@MainActor
struct CustomUndoManagerView<Content: View>: UIViewControllerRepresentable {
private let undoManager: UndoManager
private let content: Content
init(undoManager: UndoManager, @ViewBuilder builder: () -> Content) {
#import "SceneDelegate.hpp"
#import "RootViewController.hpp"
#import <objc/message.h>
@implementation SceneDelegate
- (void)dealloc {
[_window release];
[super dealloc];
}
// UIWindowScene+interfaceOrientationDidChangeNotification.h
#import <UIKit/UIKit.h>
NS_HEADER_AUDIT_BEGIN(nullability, sendability)
static NSNotificationName const UIWindowSceneInterfaceOrientationDidChangeNotification = @"UIWindowSceneInterfaceOrientationDidChangeNotification";
static NSString * const UIWindowSceneInterfaceOrientationValueUserInfoKey = @"UIWindowSceneInterfaceOrientationValueUserInfoKey";
static NSString * const UIWindowSceneInterfaceOrientationAnimationDurationUserInfoKey = @"UIWindowSceneInterfaceOrientationAnimationDurationUserInfoKey";
/*
- Required entitlement:
<key>com.apple.springboard.hardware-button-service.event-consumption</key>
<true/>
- Required framework:
/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices
*/
#import <UIKit/UIKit.h>
#import <concepts>
#import <functional>
template<class _Tp>
concept hashable = requires {
std::hash<_Tp>();
};
template <class T> requires std::equality_comparable<T> && std::copyable<T> && hashable<T>
class IdentifiableRef {
#import <Cocoa/Cocoa.h>
NS_HEADER_AUDIT_BEGIN(nullability, sendability)
@class SVTextField;
@protocol SVTextFieldDelegate <NSTextFieldDelegate>
@optional - (BOOL)textField:(SVTextField *)textField shouldChangeTextInRange:(NSRange)range replacementString:(NSString *)string;
@end
@interface SVTextField : NSTextField
#import <Foundation/Foundation.h>
@interface MyPlaceholderValue : NSObject
- (instancetype)initWithInteger:(NSInteger)number;
@end
@implementation MyPlaceholderValue
- (id)initWithInteger:(NSInteger)number {
CFNumberRef result = CFNumberCreate(NULL, kCFNumberNSIntegerType, &number);