Posts

Post not yet marked as solved
0 Replies
953 Views
I can’t seem to create any bot with Xcode 13 on macOS Monterey. The error message was “The server is currently unable to build for any platforms...” The app I was trying to build was the standard macOS SwiftUI application, straight from the template code. What seems to be the problem here?
Posted
by adib.
Last updated
.
Post not yet marked as solved
1 Replies
866 Views
Hi All, After the upgrade to Xcode 13 final, I can’t seem to get Xcode Server to code sign my app in a bot. Error was always: Warning: unable to build chain to self-signed root for signer "Apple Development: OS X Server (...)" Building the app directly using Xcode interactively works though. Xcode version: 13 (13A233) macOS version: Monterey 12.0 Beta (21A5534d)
Posted
by adib.
Last updated
.
Post not yet marked as solved
5 Replies
1.2k Views
I've ran into a problem when reading a high-efficiency image file and converting it into 24-bit (packed without alpha channel) vImage for further processing. The resulting image has vertical black bands in some parts and other vertical bands in which some channels are missing (i.e has a magenta or green tone to it). The problem appears ony when the source image is 3000x2000 pixels or greater.Here is a Playground code to reproduce the issue – unfortunately I can't find a way to attach files here.import Cocoa import Accelerate // width: 2000 pixels results in no banding // but width 3000 pixels results in banded image let imageFileURL = Bundle.main.url(forResource: "sample_3000", withExtension: "heic")! let imageSource = CGImageSourceCreateWithURL(imageFileURL as CFURL, nil)! let originalImage = CGImageSourceCreateImageAtIndex(imageSource, 0, nil)! let colorSpace = CGColorSpace(name: CGColorSpace.sRGB)! var expectedImageFormat = vImage_CGImageFormat( bitsPerComponent: UInt32(8), bitsPerPixel: UInt32(8 * 3), colorSpace: Unmanaged.passUnretained(colorSpace), bitmapInfo: CGBitmapInfo(rawValue: CGBitmapInfo.byteOrder32Big.rawValue | CGImageAlphaInfo.none.rawValue), version: 0, decode: nil, renderingIntent: originalImage.renderingIntent ) var buff = vImage_Buffer() buff.height = vImagePixelCount(originalImage.height) buff.width = vImagePixelCount(originalImage.width) buff.rowBytes = Int(buff.width) * (Int(expectedImageFormat.bitsPerPixel) + 7) / Int(expectedImageFormat.bitsPerComponent) let bufferData = NSMutableData(length: Int(buff.height) * buff.rowBytes)! buff.data = bufferData.mutableBytes let initErr = vImageBuffer_InitWithCGImage(&buff, &expectedImageFormat, nil, originalImage, numericCast(kvImagePrintDiagnosticsToConsole | kvImageNoAllocate)) guard initErr == kvImageNoError else { print("error creating image: \(initErr)") abort() } var convertError = kvImageNoError let convertedImageUnmanaged = vImageCreateCGImageFromBuffer( &buff, &expectedImageFormat, nil, // callback nil, // user data numericCast(kvImagePrintDiagnosticsToConsole | kvImageNoAllocate), &convertError ) guard convertError == kvImageNoError else { print("error converting image: \(convertError)") abort() } let convertedImage = convertedImageUnmanaged!.takeRetainedValue() // show the image – has vertical banding // write it to a temp file let tempBase = URL(fileURLWithPath:NSTemporaryDirectory()) let tempDir = tempBase.appendingPathComponent(UUID().uuidString, isDirectory: true) try FileManager.default.createDirectory(at: tempDir, withIntermediateDirectories: true, attributes: nil) let targetURL = tempDir.appendingPathComponent("result.tiff") try NSImage(cgImage: convertedImage, size: .zero).tiffRepresentation?.write(to: targetURL) print("Result image written to directory \(tempDir)")Environment:Xcode 11.3 (11C29)macOS 10.15.2 (19C57)In case anybody from Apple is watching, this is filed as FB7497362 and also contains the Playground bundle along with sample input and output images.
Posted
by adib.
Last updated
.
Post not yet marked as solved
1 Replies
1.5k Views
My app has different layouts when in the iPad is in horizontal or in vertical orientation. It uses the size of the view controller to determine its orientation – regardless of the device's actual orientation (for example, the iPad Pro in split screen landscape mode would be in "portrait" mode since each half's height is larger than its width.I'm trying to create a launch storyboard for the app that shows its "blank state". However I'm having difficulties in setting up differing layout constraints for horizontal and vertical modes in the storyboard.In Xcode 11.4.1 I see only size classes and color gamut as criteria to activate/de-activate layout constraints. Similarly stack view's axis could only be differentiated by size classes. However iPad has the same size classes when shown in portrait or landscape. The size class only changes when the app is in split screen or slide-over mode.Is there a way to lay-out launch storyboards differently based on the orientation of the view?
Posted
by adib.
Last updated
.
Post not yet marked as solved
1 Replies
3.5k Views
I'm trying to bind an array of strings into their corresponding text fields in a scrolling list. The number of rows is variable, and corresponds to the number of elements in the string array. The user can add or delete rows, as well as changing the text within each row.The following Playground code is a simplified version of what I'm trying to achieveimport SwiftUI import PlaygroundSupport struct Model { struct Row : Identifiable { var textContent = "" let id = UUID() } var rows: [Row] } struct ElementCell: View { @Binding var row: Model.Row var body: some View { TextField("Field",text: $row.textContent) } } struct ElementList: View { @Binding var model: Model var body: some View { List { ForEach($model.rows) { ElementCell(row:$0) } } } } struct ContentView: View { @State var model = Model(rows: (1...10).map({ Model.Row(textContent:"Row \($0)") })) var body: some View { NavigationView { ElementList(model: $model) } } } PlaygroundPage.current.liveView = UIHostingController(rootView: ContentView())The issue is that I can't seem to get the "cell" to bind correctly with its corresponding element. In the example code above, Xcode 11.1 failed to compile it with error in line 26:Cannot invoke initializer for type 'ForEach<_, _, _>' with an argument list of type '(Binding<[Model.Row]>, @escaping (Binding<Model.Row>) -> ElementCell)'What would be the recommended way to bind elements that are a result of ForEach into its parent model?
Posted
by adib.
Last updated
.