alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]| /// Our custom drop-in replacement `precondition`. | |
| /// | |
| /// This will call Swift's `precondition` by default (and terminate the program). | |
| /// But it can be changed at runtime to be tested instead of terminating. | |
| func precondition(@autoclosure condition: () -> Bool, @autoclosure _ message: () -> String = "", file: StaticString = __FILE__, line: UWord = __LINE__) { | |
| preconditionClosure(condition(), message(), file, line) | |
| } | |
| /// The actual function called by our custom `precondition`. | |
| var preconditionClosure: (Bool, String, StaticString, UWord) -> () = defaultPreconditionClosure |
| import UIKit | |
| // Create a protocol that defines what APIs that you need from the singleton | |
| protocol Application { | |
| func open(url: URL) | |
| } | |
| // Make the singleton-based class conform to your protocol | |
| extension UIApplication: Application { | |
| func open(url: URL) { |
| void addMainThreadCheck(Class cls, SEL selector) { | |
| #if DEBUG | |
| void *symbol = dlsym(RTLD_DEFAULT, "__main_thread_add_check_for_selector"); | |
| if (!symbol) { | |
| return; | |
| } | |
| void (*addCheck)(Class, SEL) = (__typeof__(addCheck))symbol; | |
| addCheck(cls, selector); | |
| #endif | |
| } |
Hi all, @dan-zheng and I wrote a proposal to introduce static callables to Swift. This proposal is also available as a gist here. We'd love to hear your feedback.
- Proposal: SE-NNNN
- Authors: Richard Wei, Dan Zheng
- Review Manager: TBD
- Status: Implementation in progress
| import Cocoa | |
| // https://cocoa-dev.apple.narkive.com/Ciy40e20/is-cloning-the-same-as-copying-in-apfs#post8 | |
| func unclonedSize(of url: URL) throws -> off_t { | |
| var list = attrlist(bitmapcount: UInt16(ATTR_BIT_MAP_COUNT), | |
| reserved: 0, | |
| commonattr: 0, | |
| volattr: 0, | |
| dirattr: 0, | |
| fileattr: 0, |
Few tips from using the nix package manager on macOS.
| // | |
| // main.m | |
| // EndpointSecurityDemo | |
| // | |
| // Created by Omar Ikram on 17/06/2019 - macOS Catalina 10.15 Beta 1 (19A471t) | |
| // Updated by Omar Ikram on 15/08/2019 - macOS Catalina 10.15 Beta 5 (19A526h) | |
| // Updated by Omar Ikram on 01/12/2019 - macOS Catalina 10.15 (19A583) | |
| // Updated by Omar Ikram on 31/01/2021 - macOS Big Sur 11.1 (20C69) | |
| // Updated by Omar Ikram on 07/05/2021 - macOS Big Sur 11.3.1 (20E241) | |
| // Updated by Omar Ikram on 04/07/2021 - macOS Monterey 12 Beta 2 (21A5268h) |
Recently, we wanted call swift-demangle from code, but calling out to the
process frequently was a bit too slow, and meant parsing the output of
-tree-only, since we wanted to access module and class names, for example.
Fortunately there's libswiftDemangle.dylib for this, but it's a C++ API.
Compiling against it requires #includeing headers from both Swift and LLVM.
Using CMake, both Swift and LLVM can easily be added as dependencies, but we build this project with SwiftPM. To build with SwiftPM, we imported the necessary headers. Roughly, here are the steps to determine which specific Swift
| # typed: false | |
| # frozen_string_literal: true | |
| # Note: This is loaded *ludicrously* early in the boot process: please don't | |
| # introduce other dependencies here. | |
| # === | |
| # Okay so here's the deal. When we compile a bundle of ruby code via | |
| # `bundlerEnv`, we install all the gems individually into a bunch of separate |