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
// | |
// KeyCommand.swift | |
// Adds Keyboard Shortcuts to SwiftUI on iOS 13 | |
// See https://steipete.com/posts/fixing-keyboardshortcut-in-swiftui/ | |
// License: MIT | |
// | |
// Usage: (wrap view in `KeyboardEnabledHostingController`) | |
// Button(action: { | |
// print("Button Tapped!!") | |
// }) { |
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
/// Perform an immediate mutation of `subject`. The `transform` function may | |
/// just mutate the given `subject` or replace it entirely. | |
/// | |
/// - Parameters: | |
/// - subject: A value to be transformed. | |
/// - transform: A closure that mutates or replaces the `subject`. | |
@inlinable func with<T>(_ subject: T, _ transform: (_ subject: inout T) throws -> Void) rethrows -> T { | |
var subject = subject | |
try transform(&subject) | |
return subject |
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
// Helper to hold the parent VC weakly | |
class WeakViewControllerHolder: ObservableObject { | |
weak var vc: UIViewController? | |
init(_ vc: UIViewController) { | |
self.vc = vc | |
} | |
} | |
@available(iOS 13.0, *) |
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
Process: SafariBookmarksSyncAgent [62985] | |
Path: /Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 13.7.simruntime/Contents/Resources/RuntimeRoot/System/Library/CoreServices/SafariSupport.bundle/SafariBookmarksSyncAgent | |
Identifier: SafariBookmarksSyncAgent | |
Version: 609 (609.3.5.0.2) | |
Code Type: X86-64 (Translated) | |
Parent Process: launchd_sim [46734] | |
Responsible: SimulatorTrampoline [823] | |
User ID: 501 | |
Date/Time: 2020-11-29 13:42:02.003 +0100 |
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
@objc(PSTArchitecture) class Architecture: NSObject { | |
/// Check if process runs under Rosetta 2. | |
/// | |
/// Use to disable tests that use WebKit when running on Apple Silicon | |
/// FB8920323: Crash in WebKit memory allocator on Apple Silicon when iOS below 14 | |
/// Crash is in JavaScriptCore: bmalloc::HeapConstants::HeapConstants(std::__1::lock_guard<bmalloc::Mutex> const&) | |
@objc class var isRosettaEmulated: Bool { | |
// Issue is specific to Simulator, not real devices | |
#if targetEnvironment(simulator) | |
return processIsTranslated() == EMULATED_EXECUTION |
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
/// Higher-order functions for `NSDictionary`. | |
@interface NSDictionary <KeyType, ObjectType> (PSPDFFoundation) | |
/// Converts the current dictionary into a case insensitive one. | |
@property (nonatomic, readonly) NSDictionary<NSString *, ObjectType> *pst_caseInsensitiveDictionary; | |
@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
// Hack to exclude arm64 when building Mac Catalyst in Xcode 12.2 | |
// If this is not set and we do not set macosx as SUPPORTED_PLATFORMS, then selecting Mac as target forces arm64. | |
// This can be worked around by setting ONLY_ACTIVE_ARCH to NO (slow) or using the EXCLUDED_ARCHS trick | |
// Inspired by https://github.com/Carthage/Carthage/issues/3019 | |
EXCLUDED_ARCHS__IS_MACCATALYST_YES__NATIVE_ARCH_64_BIT_x86_64=arm64 arm64e armv7 armv7s armv6 armv8 | |
EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__IS_MACCATALYST_$(IS_MACCATALYST)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)) |
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 os.log | |
class URLCacheTest { | |
let logger = Logger(subsystem: "URLCacheTest", category: "main") | |
// HTTP HEADERS: | |
// Date: Wed, 04 Nov 2020 11:13:24 GMT | |
// Server: Apache | |
// Strict-Transport-Security: max-age=63072000; includeSubdomains; preload |
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
Invalid products: com.example.apple-samplecode.fruta.unlock-recipes | |
2020-10-25 15:46:23.664364+0100 Fruta[25696:2730598] [SwiftUI] Modifying state during view update, this will cause undefined behavior. | |
2020-10-25 15:46:23.664705+0100 Fruta[25696:2730598] [SwiftUI] Modifying state during view update, this will cause undefined behavior. | |
2020-10-25 15:46:23.929321+0100 Fruta[25696:2730598] Metal API Validation Enabled | |
2020-10-25 15:46:23.967322+0100 Fruta[25696:2730598] VPA info: plugin is INTEL, AVD_id = 1080020, AVD_api.Create:0x1154fe95f | |
2020-10-25 15:47:46.728654+0100 Fruta[25696:2730598] [Layout] Unable to simultaneously satisfy constraints: | |
( | |
"<NSAutoresizingMaskLayoutConstraint:0x6000031f0aa0 h=-&- v=-&- _NSTextContentView:0x7f96e4de29b0.minX == 0 (active, names: '|':NSTextView:0x7f9685f95ac0 )>", | |
"<NSAutoresizingMaskLayoutConstraint:0x6000031f3020 h=-&- v=-&- H:[_NSTextContentView:0x7f96e4de29b0]-(380)-| (active, names: '|':NSTextView:0x7f9685f95ac0 )>", | |
"<NSAutoresizingMaskLayoutConstra |