This file contains hidden or 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 hidden or 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 hidden or 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 |
This file contains hidden or 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
private func speedupDocumentSaving() throws { | |
// SwiftUI triggers updateChangeCount: when the binding changes, | |
// which triggers an autosave operation to eventually store the document. | |
// There's no direct way to access UIDocument (used inside SwiftUI.PlatformDocument) | |
// to speed up this process. It is noticable as it delays changing the thumbnail. | |
// While saving is triggered instantly when the application backgrounds, | |
// we still want to update the document immediately. | |
// | |
// We could apply this to SwiftUI.PlatformDocument for a more narrow tweak. | |
// We could also swizzle the NSTimer initializer, check for the target being PlatformDocument |
This file contains hidden or 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
extension UIHostingController { | |
convenience public init(rootView: Content, ignoreSafeArea: Bool) { | |
self.init(rootView: rootView) | |
if ignoreSafeArea { | |
disableSafeArea() | |
} | |
} | |
func disableSafeArea() { |
This file contains hidden or 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 Combine | |
@available(iOS 13.0, *) | |
extension NSObject { | |
private struct AssociatedKeys { | |
static var disposeBag: UInt8 = 0 | |
} | |
/// Stores a Combine AnyCancellable with the current object's disposeBag. |
This file contains hidden or 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
public var byteRange: [Range<UInt64>]? { | |
// Guaranteed to be in pairs. Example: | |
// - 0 : 0 | |
// - 1 : 71826 | |
// - 2 : 83948 | |
// - 3 : 34223 | |
guard let boxedRange = __byteRange else { return nil } | |
let range = boxedRange.map { $0.uint64Value } | |
var ranges: [Range<UInt64>] = [] |
This file contains hidden or 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
let subsystem = "com.steipete.LoggingTest" | |
func getLogEntries() throws -> [OSLogEntryLog] { | |
// FB8269189: OSLogStore does not work iOS. | |
let logStore = try OSLogStore(scope: .currentProcessIdentifier) | |
let oneHourAgo = logStore.position(date: Date().addingTimeInterval(-3600)) | |
#if os(macOS) | |
let allEntries = try logStore.getEntries(at: oneHourAgo) | |
#else |