This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import CoreFoundation | |
// https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFCollections/Articles/creating.html#//apple_ref/doc/uid/20001132-101215-CHDEBBDB | |
class MyObject: NSObject { | |
var string: NSString | |
init(string: NSString) { | |
self.string = string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <ranges> | |
#include <string> | |
#import "MyScript2-Swift.h" | |
std::string getStringFromSwiftString(swift::String string) { | |
std::string result {}; | |
swift::UTF8View utf8View = string.getUtf8(); | |
swift::String_Index startIndex = utf8View.getStartIndex(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
final class HeaderTextView: NSTextView { | |
private lazy var headerTextField: NSTextField = { | |
let headerTextField: NSTextField = .init(frame: .init(x: .zero, y: .zero, width: bounds.size.width, height: 20.0)) | |
headerTextField.backgroundColor = .systemGray | |
headerTextField.stringValue = "I am Header View!" | |
return headerTextField | |
}() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
@_spi(SwiftUI) import Observation | |
@Observable | |
class ViewModel { | |
var number: Int | |
init(number: Int) { | |
self.number = number | |
print(self.number) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <CoreData/CoreData.h> | |
#import <execinfo.h> | |
#import <objc/runtime.h> | |
#import <dlfcn.h> | |
#import <ranges> | |
namespace FixNSPropertyDescription { | |
NSCompositeAttributeDescription * (*original)(__kindof NSPropertyDescription *, SEL); | |
NSCompositeAttributeDescription *custom_1(__kindof NSPropertyDescription *self, SEL _cmd) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import SwiftUI | |
fileprivate let storageKey: UnsafeMutableRawPointer = .allocate(byteCount: 1, alignment: 1) | |
fileprivate let willDealloc: UnsafeMutableRawPointer = .allocate(byteCount: 1, alignment: 1) | |
fileprivate var didSwizzle: Bool = false | |
extension View { | |
func fixMemoryLeak() -> some View { | |
if #available(iOS 17.2, *) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
@main | |
struct MyAppApp: App { | |
var body: some Scene { | |
WindowGroup { | |
ContentView() | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
OBJC_EXPORT id objc_storeWeak(id *location, id newObj); | |
OBJC_EXPORT id objc_loadWeak(id *location); | |
OBJC_EXPORT void objc_destroyWeak(id *location); | |
OBJC_EXPORT void objc_setProperty_atomic(id _Nullable self, SEL _Nonnull _cmd, id _Nullable newValue, ptrdiff_t offset); // objc_setProperty, objc_setProperty_atomic, objc_setProperty_nonatomic, objc_setProperty_nonatomic_copy | |
OBJC_EXPORT id _Nullable objc_getProperty(id _Nullable self, SEL _Nonnull _cmd, ptrdiff_t offset, BOOL atomic); | |
@interface MyObject : NSObject { | |
@private id _weak_property; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.m | |
// MyApp | |
// | |
// Created by Jinwoo Kim on 12/9/23. | |
// | |
#import "ViewController.h" | |
#import <objc/message.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PHPickerConfiguration+OnlyReturnsIdentifiers.hpp | |
// SurfVideo | |
// | |
// Created by Jinwoo Kim on 12/6/23. | |
// | |
#import <PhotosUI/PhotosUI.h> | |
NS_ASSUME_NONNULL_BEGIN |