Skip to content

Instantly share code, notes, and snippets.

2021-11-07 16:43:14 +0100 Notification Display is turned off
2021-11-07 16:43:14 +0100 Assertions PID 315(powerd) Released PreventUserIdleSystemSleep "Powerd - Prevent sleep while display is on" 00:00:51 id:0x0x100008007 [System: DeclUser BGTask SysAct SRPrevSleep IPushSrvc kCPU kDisp]
2021-11-07 16:43:14 +0100 Assertions PID 315(powerd) Summary UserIsActive "com.apple.powerd.ws.initialize" 00:00:51 id:0x0x900008008 [System: DeclUser BGTask SysAct SRPrevSleep IPushSrvc kCPU kDisp]
2021-11-07 16:43:14 +0100 Assertions PID 375(WindowServer) Summary UserIsActive "com.apple.iohideventsystem.queue.tickle serviceID:1000008f5 name:NULL product:Apple Internal Keyb eventType:11" 00:00:06 id:0x0x900008029 [System: DeclUser BGTask SysAct SRPrevSleep IPushSrvc kCPU kDisp]
2021-11-07 16:43:14 +0100 Assertions PID 344(apsd) Summary ApplePushServiceTask "com.apple.apsd-lastpowerassertionlinger" 00:00:00 id:0x0xb000081e7 [System: DeclUser BGTask SysAct SRPrevSleep IPushSrvc
tell application "System Events"
tell appearance preferences
set willBeDark to not dark mode
set dark mode to willBeDark
end tell
end tell
set terminalTheme to "Tomorrow16"
if willBeDark then
set terminalTheme to "TomorrowNight16"
@fastred
fastred / UIKit.diff
Created June 7, 2017 16:50
UIKit.diff
This file has been truncated, but you can view the full file.
diff --git a/UIKit/CDStructures.h b/UIKit/CDStructures.h
index 56bd9915..c4061249 100644
--- a/UIKit/CDStructures.h
+++ b/UIKit/CDStructures.h
@@ -6,14 +6,35 @@
@class NSString, NSTimer, UIWebPDFView;
-#pragma mark Function Pointers and Blocks
-
//
// UILabel+JumpingDots.swift
// JumpingDots
//
// Copyright (c) 2016 Arkadiusz Holko. All rights reserved.
//
import UIKit
import ObjectiveC
@fastred
fastred / NS_REFINED_FOR_SWIFT.md
Last active June 21, 2016 13:35
NS_REFINED_FOR_SWIFT

Results of searching for NS_REFINED_FOR_SWIFT in the headers.

Foundation.framework/Headers/NSCoder.h

#if !defined(SWIFT_CLASS_EXTRA) || (defined(SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH) && SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH >= 5)
- (nullable id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0) NS_REFINED_FOR_SWIFT;
#else
- (nullable id)decodeObjectOfClasses:(nullable NSSet<Class> *)classes forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0);
#endif
@fastred
fastred / NS_SWIFT_UNAVAILABLE.md
Last active February 6, 2022 15:35
NS_SWIFT_UNAVAILABLE

Results of searching for NS_SWIFT_UNAVAILABLE macro in iOS 9 and OS X 10.11 headers reveal some new Swift-specific APIs.

Highlights

GameplayKit.framework/Headers/GKEntity.h
70: - (nullable GKComponent *)componentForClass:(Class)componentClass
NS_SWIFT_UNAVAILABLE("Exposed in Swift as componentForClass<ComponentType: GKComponent>(componentClass: ComponentType.Type) -> ComponentType?");

GameplayKit.framework/Headers/GKStateMachine.h
@fastred
fastred / response.md
Last active August 29, 2015 14:04
My response to https://twitter.com/ericasadun/status/490180083827503104, i.e. why the iPhone has a compact horizontal size class in a landscape orientation

And size class deals with, on a coarse level, the available space that your application has and can therefore make decisions about what its structure should be.

...

So, a size class is all about informing your application of the available space in some coarse way that you can make decisions about how you would substantially alter the application's structure.

—Bruce D. Nilo, Session 214, WWDC 2014

Based on the above citation I assume, that Apple decided there are different horizontal and vertical tresholds of sizes that influence the application's structure:

@fastred
fastred / gist:96f3829ed676ed599aeb
Last active August 29, 2015 14:03
NSProgress.markdown

Cleaned up results of running ack NSProgress ./ in

  • /Applications/Xcode6-Beta3.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk/System/Library/Frameworks
  • /Applications/Xcode6-Beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks

iOS:

CoreData.framework/Headers/NSPersistentStoreResult.h:10:@class NSProgress;
CoreData.framework/Headers/NSPersistentStoreResult.h:33:    NSProgress* _requestProgress;
CoreData.framework/Headers/NSPersistentStoreResult.h:42:@property (strong, readonly) NSProgress* progress;
curl https://developer.apple.com/videos/wwdc/2014/ | grep -iIoh 'http.*._hd_.*dl=1">HD' | sed -e 's/\?dl=1">HD//g' | xargs -n1 wget -N
@fastred
fastred / 1.m
Last active March 15, 2019 13:58
Use UIPanGestureRecognizer instead of UIScreenEdgePanGestureRecognizer
// it's just a proof of concept; there are known problems with this solution
- (void)addPanGestureForPopTransitioning
{
UINavigationController *navigationController = self.navigationController;
NSArray *targets = [navigationController.interactivePopGestureRecognizer valueForKey:@"_targets"];
if ([targets isKindOfClass:[NSArray class]]) {
@try {
id interactivePanTarget = [[targets firstObject] valueForKey:@"target"];
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:interactivePanTarget action:NSSelectorFromString(@"handleNavigationTransition:")];
[navigationController.view addGestureRecognizer:panRecognizer];