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
- (void)method | |
{ | |
NSUndoManager *undoManager = [self undoManager]; | |
[undoManager disableUndoRegistration]; | |
/* do something */ | |
[self.managedObjectContext processPendingChanges]; | |
[undoManager enableUndoRegistration]; | |
} |
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 XCTest | |
public func XCTAssertThrowsError<T, E: Error & Equatable>( | |
_ expression: @autoclosure () throws -> T, | |
expected expectedError: E, | |
_ message: String = "", | |
file: StaticString = #filePath, | |
line: UInt = #line | |
) { | |
XCTAssertThrowsError(try expression(), message, file: file, line: line) { error in |
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 AppKit | |
public extension NSBezierPath { | |
public convenience init(path: CGPath) { | |
self.init() | |
let pathPtr = UnsafeMutablePointer<NSBezierPath>.alloc(1) | |
pathPtr.initialize(self) | |
This is an excerpt from our internal documentation describing an issue with drawing in NSView
s on macOS Big Sur.
In macOS Big Sur (probably starting with β9), Apple changed the default contents format for backing layers of NSView
s. Instead of an explicit CALayerContentsFormat.RGBA8Uint
value, an „Automatic“ value is now used. Even though it also resolves into „RGBA8“ in our testing, it has some serious implications as it breaks assumptions our code relies on.
I first stumbled upon this issue in this tweet by Frank. It links to a thread on Apple Forums by Mark that contains valuable information as well as ideas for workarounds. The changed behavior was also confirmed by Marcin in this tweet.
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 InterposeKit | |
import UIKit | |
import SwiftUI | |
import SwiftUIIntrospect | |
extension View { | |
public func keyboardAvoidanceDisabled() -> some View { | |
self.introspect(.viewController, on: .iOS(.v17)) { viewController in | |
if let hostingView = viewController.parent?.view { | |
if String(describing: type(of: hostingView)).hasPrefix("_UIHostingView") { |
Shortcut | Description | Overridable?[^1] |
---|---|---|
Fn-A |
Navigate Dock | No |
Fn-Shift-A |
Launchpad | No |
Fn-C |
Control Center | No |
Fn-E |
Emoji & Symbols | Yes |
Fn-F |
Enter/Exit Full Screen | Yes |
Fn-H |
Desktop | No |
Fn-M |
Navigate Main Menu | Yes |
Fn-N |
Notifications | No |
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 InterposeKit | |
import SwiftUI | |
/// A workaround for an issue in SwiftUI related to delayed highlighting of list rows upon user | |
/// interaction, rendering it inconsistent with UIKit. | |
/// | |
/// This fix implements the solution proposed by Léo Natan and utilizes `InterposeKit` by Peter | |
/// Steinberger to modify the behavior of `UICollectionViewCell` instances used internally | |
/// by SwiftUI. | |
/// |
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
/// MIT License | |
/// | |
/// Copyright (c) 2021 Lukas Kubanek, Structured Path GmbH | |
/// | |
/// Permission is hereby granted, free of charge, to any person obtaining a copy | |
/// of this software and associated documentation files (the "Software"), to deal | |
/// in the Software without restriction, including without limitation the rights | |
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
/// copies of the Software, and to permit persons to whom the Software is | |
/// furnished to do so, subject to the following conditions: |
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 | |
extension View { | |
/// A custom popover modifier that ensures the system automatically selects the best | |
/// orientation for the popover's arrow, compatible with both iOS 17 and 18. | |
/// | |
/// On iOS 17, the `arrowEdge` is treated as a hint and may be ignored if the popover does | |
/// not fit. On iOS 18, the `arrowEdge` is strictly enforced, potentially causing layout | |
/// issues if the content doesn't fit. |
OlderNewer