Has three sections.
defaults: {
“com.apple.MobileBluetooth.debug” = {
ExtraZoningLog = {
EnableZoneLogging = 1;
};
FWStreamLogging = {
#!/usr/bin/env sh | |
# usage: sh ./generate-target-dependencies.sh | dot -Tsvg -o target-graph.svg | |
packages=`swift package describe --type json` | |
targets=`echo $packages | jq '.targets'` | |
target_names=`echo $targets | jq -r '.[] | .name'` | |
body="" | |
template=`cat <<EOF | |
digraph DependenciesGraph { |
protocol ReferenceEncodable: Identifiable { | |
static var referenceStorageKey: CodingUserInfoKey { get } | |
} | |
extension ReferenceEncodable { | |
static var referenceStorageKey: CodingUserInfoKey { | |
CodingUserInfoKey(rawValue: String(describing: Self.self) + "ReferenceStorage")! | |
} | |
} |
@objc protocol ExampleActions: AnyObject { | |
func pushUIKitViewController() | |
} | |
struct ExampleView: View { | |
@FirstResponder private var firstResponder | |
var body: some View { | |
Button { | |
firstResponder.sendAction(#selector(ExampleActions.pushUIKitViewController)) |
class DetailViewPresentationController: UIPresentationController { | |
override var frameOfPresentedViewInContainerView: CGRect { | |
guard let containerView = containerView else { | |
return super.frameOfPresentedViewInContainerView | |
} | |
if traitCollection.verticalSizeClass == .compact { | |
return CGRect(x: 72, y: 64, width: containerView.frame.width - 144, height: containerView.frame.height) | |
} else { |
import Combine | |
import SwiftUI | |
extension View { | |
public func focused<T>(file: StaticString = #file, _ state: FocusState<T>, equals value: T) -> some View { | |
modifier(FocusedModifier(state: state, id: value, file: file)) | |
} | |
} | |
@propertyWrapper |
import Foundation | |
import SwiftUI | |
extension EnvironmentValues { | |
public func value<T>(_: T.Type = T.self, forKey key: String) -> T? { | |
guard let value = first(where: { name($0, equals: key) }) else { | |
print("No EnvironmentValue with key '\(key)' found.") | |
return nil | |
} |
extension View { | |
func relative(width: CGFloat? = nil, height: CGFloat? = nil, alignment: Alignment = .center) -> some View { | |
Color.clear | |
.frame(maxWidth: width.map { _ in .infinity }, maxHeight: height.map { _ in .infinity }) | |
.overlay(GeometryReader { proxy in | |
ZStack { | |
self.frame( | |
width: width.map { proxy.size.width * $0 }, | |
height: height.map { proxy.size.height * $0 } | |
) |
// Simplified version of https://gist.github.com/anandabits/d9494d14fef221983ff4f1cafa318d47#file-areequatablyequal-swift | |
func isEqual(x: Any, y: Any) -> Bool { | |
func f<LHS>(_ lhs: LHS) -> Bool { | |
let p = Wrapper<LHS>.self as? AnyEquatable.Type | |
return p?.isEqual(x, y) ?? false | |
} | |
return _openExistential(x, do: f) | |
} |
import Darwin | |
import Foundation | |
import UIKit | |
// https://github.com/xybp888/iOS-SDKs/blob/master/iPhoneOS17.1.sdk/System/Library/PrivateFrameworks/CoreSVG.framework/CoreSVG.tbd | |
// https://developer.limneos.net/index.php?ios=17.1&framework=UIKitCore.framework&header=UIImage.h | |
@objc | |
class CGSVGDocument: NSObject { } |