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/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 |
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> | |
@interface MyPlaceholderValue : NSObject | |
- (instancetype)initWithInteger:(NSInteger)number; | |
@end | |
@implementation MyPlaceholderValue | |
- (id)initWithInteger:(NSInteger)number { | |
CFNumberRef result = CFNumberCreate(NULL, kCFNumberNSIntegerType, &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
- (IBAction)foo:(id)sender { | |
unsigned int ivarsCount; | |
// 버그 : Xcode 15.0 beta 7 SDK에서 UITitlebar symbol이 정의되어 있지 않으므로 UITitlebar.class라고 표기하면 에러 | |
Ivar *ivars = class_copyIvarList(NSClassFromString(@"UITitlebar"), &ivarsCount); | |
auto result = std::ranges::find_if(std::ranges::subrange(ivars, ivars + ivarsCount), [](Ivar ivar) { | |
auto name = ivar_getName(ivar); | |
return !std::strcmp(name, "_hostWindow"); | |
}); |
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
// | |
// NSManagedObject+Concurrency.swift | |
// | |
// | |
// Created by Jinwoo Kim on 8/12/23. | |
// | |
import CoreData | |
extension NSManagedObject { |
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 Observation | |
actor NumberViewModel: Observable { | |
// MARK: - Number | |
private let _numberStorage: UnsafeMutablePointer<Int> = .allocate(capacity: 1) | |
private nonisolated var _number: Int { | |
get { | |
observationRegistrar.access(self, keyPath: \._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 UIKit | |
extension UITraitChangeObservable where Self: AnyObject { | |
@MainActor | |
func traitChangesStream<TraitEnvironment: UITraitEnvironment>(traitEnvironment: TraitEnvironment.Type, traits: [UITrait]) -> AsyncStream<(TraitEnvironment, UITraitCollection)> { | |
let stream = AsyncStream<(TraitEnvironment, UITraitCollection)>.makeStream() | |
let registration = registerForTraitChanges(traits, handler: { (traitEnvironment: TraitEnvironment, previousTraitCollection: UITraitCollection) in | |
stream.continuation.yield(with: .success((traitEnvironment, previousTraitCollection))) | |
}) |
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 Combine | |
extension UITraitChangeObservable where Self: AnyObject { | |
func traitChanges<TraitEnvironment: UITraitEnvironment>(traitEnvironment: TraitEnvironment.Type, traits: [UITrait]) -> some Publisher<(TraitEnvironment, UITraitCollection), Never> { | |
let subject = PassthroughSubject<(TraitEnvironment, UITraitCollection), Never>() | |
let registration = registerForTraitChanges(traits, handler: { [weak subject] (traitEnvironment: TraitEnvironment, previousTraitCollection: UITraitCollection) in | |
subject?.send((traitEnvironment, previousTraitCollection)) | |
}) | |
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
// File: UIWindowScene+DidChangeScreenNotification.h | |
#import <UIKit/UIKit.h> | |
NS_ASSUME_NONNULL_BEGIN | |
static NSNotificationName const __UIWindowSceneDidChangeScreenNotification = @"__UIWindowSceneDidChangeScreenNotification"; | |
@interface UIWindowScene (DidChangeScreenNotification) | |
@end |
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/UIKit.h> | |
#import <substrate.h> | |
static void *DO_UIWindowScene_Association_Key; | |
@interface FBSScene : NSObject | |
@end | |
@interface UIScene (DO_Private) | |
+ (UIScene *)_sceneForFBSScene:(FBSScene *)arg1 create:(BOOL)arg2 withSession:(UISceneSession *)arg3 connectionOptions:(UISceneConnectionOptions *)arg4; |
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 | |
extension URLComponents { | |
func url(removingPercentEncoding: Bool) -> URL? { | |
guard let url: URL else { | |
return nil | |
} | |
guard removingPercentEncoding, | |
let refinedPath: String = url.absoluteString.removingPercentEncoding else { |