Post

Replies

Boosts

Views

Activity

Reply to The base messages extension template builds but won't install or load
Just tried 16 beta 2. It's broken in the same way as 15.3. This has made the workflow for developing message extensions almost impossible because i keep forgetting to do the extra of switching the scheme to run the base app, waiting for it to time out and then switching the scheme back to the message extension... and even worse it will happily execute the older build of the extension, so it's not always obvious that it didn't update.
Jun ’24
Reply to The base messages extension template builds but won't install or load
Having the same issue since updating to 15.3. I wonder if it's specific to cases (like mine) where the main app is just an empty container that holds the extension (you can't run it directly) Is there perhaps a way to configure the run scheme to build and deploy the main target app before running the messages extension? I've been trying but without success
May ’24
Reply to Is it possible to compile images into an APNG using Swift?
Apple's documentation actually provides a Swift example of building a .apng that is quite old but still works just fine with a few modifications (I just tested it): https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/ImageIOGuide/ikpg_dest/ikpg_dest.html the second example (listing 3-3) is what you're interested in. The reference to kUTTypePNG, which is deprecated, can be updated to UTType.png.identifier as CFString. Otherwise, you'll need to actually write the code to provide the UIImages. There's also this mysterious line in their example let radians = M_PI * 2.0 * Double(i) / Double(frameCount) which doesn't do anything and can be removed. My guess is the author was going to use it to render a rotating image but didn't bother to actually implement it. One other thing to note is that it seems like you may want to write the file with a ".png" extension even if it's an apng. I found instances where the ".apng" extension actually caused it to not work, but i'm not sure what the intended behavior is.
Topic: Media Technologies SubTopic: General Tags:
Mar ’24
Reply to overrideUserInterfaceStyle in tvOS not working?
What I finally realized many months later is that it does work... it just doesn't change the default background. So, if you leave your main view's background on Default (transparent) and your if your Apple TV is set to light mode and you override the interface to use dark mode, everything will display in dark mode, except whatever the Apple TV's current background is will appear behind it.
Topic: UI Frameworks SubTopic: UIKit Tags:
Sep ’21
Reply to Setting a view's CALayer.contents to CVPixelBuffer directly
Sure, create a blank project and make this your viewcontroller code. If it works, you'll see a rainbow gradient on your screen. I can verify this works on my iPhone XS // // ViewController.swift // TestBuffer // // Created by Ilardi, Michael on 4/9/21. // import UIKit class ViewController: UIViewController {           override func viewDidLoad() {     super.viewDidLoad()                //create a rainbow RGB in a Uint32 array     let width = 256,height=256           var buffer: [UInt32] = []                 for i in 0...width - 1 {       for j in 0...height - 1{                          var color:UInt32         let r = UInt32 ((Float(i)/(Float(height))) * 255.0)         let g = UInt32 ((Float(j)/(Float(width))) * 255.0)         let b = UInt32 (128)         color = (r 24) + (g 16) + (b 8) + 255;                   buffer.append(color)                 }     }                //now create a CVPixelBuffer and copy our rainbow array into it           let format = kCVPixelFormatType_32ARGB               // kCVPixelFormatType_32ARGB     let sourcePixelBufferOptions: NSDictionary = [kCVPixelBufferPixelFormatTypeKey: format,       kCVPixelBufferWidthKey: width,       kCVPixelBufferHeightKey: height,       kCVPixelBufferIOSurfacePropertiesKey: NSDictionary(),       kCVPixelBufferIOSurfaceCoreAnimationCompatibilityKey:true,       kCVPixelBufferCGBitmapContextCompatibilityKey:true     ]           var pix:CVPixelBuffer?            CVPixelBufferCreate(kCFAllocatorDefault, width, height, format, sourcePixelBufferOptions, &pix)           let flags = CVPixelBufferLockFlags(rawValue: 0)     CVPixelBufferLockBaseAddress(pix! ,flags)            let pixelBufferAddress = CVPixelBufferGetBaseAddress((pix)!)               memcpy(pixelBufferAddress, buffer, 4 * height * width)     CVPixelBufferUnlockBaseAddress(pix!, flags)                       //set the main view's layer contents to our pixelbuffer           view.layer.contents = pix             }    }
Topic: Media Technologies SubTopic: Audio Tags:
Apr ’21
Reply to Setting a view's CALayer.contents to CVPixelBuffer directly
And after further poking around, what I've realized is that this is dependent upon the underlying format of the CVPixelBuffer. Setting CALayer's contents to a CVPixelBuffer actually does work on the iPad I've been testing with, as long as the CVPixelBuffer is in an RGB format. I had been using kCVPixelFormatType_422YpCbCr8 as this is a video streaming application. Interestingly, either format works fine on newer iOS devices. The best solution I have right now is have the app create test buffers, set them to the CALayer contents and then render the CALayer back to a CGImage, sample the CGImage's pixels to test which formats work and which don't. Not ideal, but I can't see any way of determining the pixel format capabilities.michael
Topic: Media Technologies SubTopic: Audio Tags:
Feb ’21
Reply to How do I render a dynamically changing IOSurface to a CALayer or NSView?
I just posted a similar question, but what I discovered was that i can just set the layer.contents to the CVPixelBuffer (no need to call CVPixelBufferGetIOSurface). I don't seem to need to call setNeedsDisplay or anything like that either... it just renders However, it only works on some of my iOS devices (an iPhone XS and an iPhone 11) while failing on my iPad Air 2. I'll also note that I'm setting the layer contents in a CADisplayLink callback function, if that's of any relevance. Did you manage to figure this out?
Topic: Programming Languages SubTopic: Swift Tags:
Feb ’21