Post

Replies

Boosts

Views

Activity

AVFoundation CaptureDevice and Mac virtual cameras
Hello, on Mac OS, is it possible to see a virtual Camera, such as OBS (https://obsproject.com) as a CaptureDevice? I see that, for example, Google Chrome can use this camera, but using AVCaptureDevice.DiscoverySession I am unable to see it. Am I doing wrong?     var deviceTypes: [AVCaptureDevice.DeviceType] = [.builtInMicrophone, .builtInWideAngleCamera]     #if os(OSX)     deviceTypes.append(.externalUnknown)     #else     deviceTypes.append(contentsOf: [.builtInDualCamera, .builtInDualWideCamera, .builtInTelephotoCamera, .builtInTripleCamera, .builtInTrueDepthCamera, .builtInUltraWideCamera])     #endif     let discoverySession = AVCaptureDevice.DiscoverySession(deviceTypes: deviceTypes,         mediaType: nil, position: .unspecified)     result = discoverySession.devices.map { device in         device.localizedName     }
1
0
1.7k
Nov ’21
Request times out with iCloud Private Relay: Why?
We have our own backend, running on our own server. When iCloud Private Relay is enabled, the requests to the server time out. How can we find out what precisely is failing? TLS 1.3 is enabled on the backend finished with error [-1001] Error Domain=NSURLErrorDomain Code=-1001 "The request timed out." UserInfo={_kCFStreamErrorCodeKey=-2102, NSUnderlyingError=0x281b0a3d0 {Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)" UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <CBAE9DA5-9988-4E55-A732-B759842E411F>.<1>, _NSURLErrorRelatedURLSessionTaskErrorKey=(     "LocalDataTask <CBAE9DA5-9988-4E55-A732-B759842E411F>.<1>" ), NSLocalizedDescription=The request timed out.,
2
0
1.3k
Nov ’21
CBService changed: How handle this in iOS 14 and 15?
Building my app with Xcode 13, a dependency threw an error related to the changes in CoreBluetooth: Some properties are now returned as optionals in iOS 15. Wanting to fix that, I would like to make sure that the library will run on both iOS 15 and SDKs prior to that, but the current availability markers will not help me:     func peripheralManager(_ peripheral: CBPeripheralManager, didAdd service: CBService, error: Error?) {         let peripheral: CBPeripheral         // So what I would like is something like this         // But this does not work :(         if  #available(iOS 15, *) {             guard let nonOptional = service.peripheral else {                 return             }             peripheral = nonOptional         } else {             peripheral = service.peripheral         }         let result: CBPeripheral = peripheral         print ("\(result)")     }``` This code will cause the compiler to throw an error both on Xcode 13 and Xcode 12. Is there any good way to solve this?
1
0
2.6k
Jun ’21
SwiftUI: Show Modal Dialog from … anywhere?
Context: Authorized Network requests. I have a process (a publisher, to be precise), which will give me a fresh access token for a request. To do that, I may need user interaction, i.e. show a View, Alert, or something like that. How can I do that in SwiftUI? Can I just (modally) display something, without explicitly being in a View body? Should I have to pass in a "superview" to do this, or do you have other ideas? Thanks Alex
0
0
1.3k
Mar ’21
Swift framework for Objective-C
Hello,hopefully, this is a real beginer question, so hopefully it is easy to answer …I want to create a new framework for an existing Objective-C app. And because Swift is all shiny, and we already are using Swift in other parts of the app, I am writing the framework in Swift.However, when I #include "${MODULENAME}-Swift.h" in my umbrella header, Xcode tells me on a clean compile: ‘'${MODULENAME}-Swift.h' file not found'If I comment that line, build, then uncomment it and build again, Xcode will find it. This, however, is unacceptable for, say, build servers.Questions:1) It appears, that when I am importing the Framework as a module (i.e. @import ${MODULENAME} ), I don't need to #include "${MODULENAME}-Swift.h" in my umbrella header.Is this true? Is it not necessary to explicitly expose the -Swift.h headers when importing the Framework as a module?2) This leads me to the next question:Do Swift Frameworks have to be imported as modules? The app is an old codebase and currently sets CLANG_ENABLE_MODULES to NO. Is it necessary to set this to YES when using a Swift Framework?3) Am I doing something wrong with the #import? If I can use the Framework not as a module, but #import &lt;Framework/Umbrella.h&gt; is good, what do I have to do to have{MODULENAME}-Swift.h available even on a clean compile?Again, hopefully these are simple questions, and someone can easily answer them 😉
3
0
7.1k
Dec ’20