Skip to content

Instantly share code, notes, and snippets.

#import "ViewController.h"
#import <objc/message.h>
#import <dlfcn.h>
OBJC_EXPORT id objc_msgSendSuper2(void);
extern BOOL UIImagePickerLoadPhotoLibraryIfNecessary(void);
@implementation ViewController
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface MyObject : NSObject <NSCopying> {
@package NSUInteger _first;
@package NSInteger _second;
@package BOOL _third;
}
@end
#import <Foundation/Foundation.h>
#pragma mark - MyDescriptor
__attribute__((objc_direct_members))
@interface MyDescriptor : NSObject {
@package NSInteger _index;
}
- (BOOL)direct_isEqual:(MyDescriptor *)other;
@end
#import <Foundation/Foundation.h>
@interface NSIndexSet (FastEnumeration) <NSFastEnumeration>
@end
@implementation NSIndexSet (FastEnumeration)
- (NSUInteger)countByEnumeratingWithState:(nonnull NSFastEnumerationState *)state objects:(id _Nullable * _Nonnull)buffer count:(NSUInteger)len {
/*
state
import UIKit
import SwiftUI
final class TraitSelectionState: UITraitDefinition, UITraitBridgedEnvironmentKey {
static func read(from traitCollection: UITraitCollection) -> Bool {
traitCollection[TraitSelectionState.self]
}
static func write(to mutableTraits: inout any UIMutableTraits, value: Bool) {
fatalError("Forbidden")
import UIKit
enum Hello {
static let foo: Int = {
var result: Int?
if Thread.isMainThread {
result = 300
} else {
DispatchQueue.main.sync {
@pookjw
pookjw / BPHostingConfiguration.swift
Last active March 14, 2024 10:14
UIHostingConfiguration for iOS 14 & 15
import UIKit
import SwiftUI
struct BPHostingConfiguration<Content: View>: UIContentConfiguration {
fileprivate let content: Content
init(@ViewBuilder content: () -> Content) {
self.content = content()
}
//
// main.mm
// Practice_PackageKit
//
// Created by Jinwoo Kim on 2/4/24.
//
#import <Foundation/Foundation.h>
#import <objc/message.h>
#import <objc/runtime.h>
import Darwin
class FooObject {
func foo() {
print(self)
foo_2()
}
}
func foo_2() {
import Foundation
@_silgen_name("swift_task_isOnExecutor")
public func _taskIsOnExecutor<Executor: SerialExecutor>(_ executor: Executor) -> Bool
final class MySerialExecutor: SerialExecutor {
private let queue: DispatchQueue = .init(label: "Hello")