Tag: #swift
devices(for:) was deprecated in macOS 10.15: Use AVCaptureDeviceDiscoverySession instead
Use
AVCaptureDeviceDiscoverySession
instead of the deprecated AVCaptureDevice.devices(for:)
to discover video capture devices. 2020-07-31How to resolve “the app shows no response upon launch” in App Review
To resolve “the app shows no response upon launch” in App Review, identify and handle potential sources of fatal errors, such as uncaught exceptions, force-unwrapping nil values, unsafe downcasts, and out-of-bounds array access. Display a helpful error message instead of crashing. 2020-04-24
What is
NSApplication
? How is it instantiated? What is NSApp
? NSApplication
is the core of a Cocoa application. It is typically instantiated via NSApplicationMain
or by calling NSApplication.shared()
. NSApp
is a global variable that holds the singleton instance of NSApplication
. 2017-03-19How to make a Cocoa application without a
.xib
file To create a Cocoa app without a
.xib
file, remove the NSMainNibFile
key from the Info.plist
, and replace the @NSApplicationMain
annotation on your AppDelegate
class with a custom main.swift
file that manually sets up the application and its delegate. 2017-03-17How do I replace target/action with callbacks in Swift?
Use a
CallbackWrapper
object to associate a closure with an NSControl
, setting the target
and action
properties to enable callback-based event handling. 2016-11-17How do I serialize JSON in Swift?
Serialize JSON in Swift with
JSONSerialization.data(withJSONObject:options:)
. 2016-11-16All content copyright James Fisher.