Hi,
I love the idea of the ImageResource struct and it is a great error reduction to automatically provide an ImageResource for every Image in the asset catalog. I immediately started to adopt it.
But I have a case where I would still need to have access to the name of the Image and the bundle. So I would suggest that you provide change the struct for ImageResource to have name and bundle as public getters. With this, there is still a safe way in the code to access the resource and still be able to use the name of the resource.
So instead of generating:
struct ImageResource: Hashable {
/// An asset catalog image resource name.
fileprivate let name: String
/// An asset catalog image resource bundle.
fileprivate let bundle: Bundle
/// Initialize an `ImageResource` with `name` and `bundle`.
init(name: String, bundle: Bundle) {
self.name = name
self.bundle = bundle
}
}
Just generate it as:
struct ImageResource: Hashable {
/// An asset catalog image resource name.
let name: String
/// An asset catalog image resource bundle.
let bundle: Bundle
/// Initialize an `ImageResource` with `name` and `bundle`.
init(name: String, bundle: Bundle) {
self.name = name
self.bundle = bundle
}
}
The same applies to ColorResource as well.
I have posted a feedback on this, but I am curious what others think about this? Am I the only one who still needs to have access to the name and the bundle of the ressource?
Xcode
RSS for tagBuild, test, and submit your app using Xcode, Apple's integrated development environment.
Post
Replies
Boosts
Views
Activity
Hello, do the String Catalogs (new in Xcode 15) support Swift Packages?
I've tried adding a new Localizable.xcstrings (string catalog) file to my package's resources folder.
Great! I then see this screen:
All good so far.
I then try to go and build my Swift Package... and nothing changes. The string catalog is never populated and I'm left with the same screen as above.
So, do string catalogs not support packages at this time or am I doing something wrong?
I was really hoping String Catalogs would work and save the day since Export Localizations also does not work for Swift packages that don't support macOS. 😔
Hello , I am facing following error while building my project on xcode cloud using custom ci scripts .
Error:
ci_post_clone.sh script is failing with following error.
Run command: 'cd /Volumes/workspace/repository/ci_scripts && /Volumes/workspace/repository/ci_scripts/ci_post_clone.sh'
/Volumes/Task/ci_plan.env: line 2: unexpected EOF while looking for matching `''
/Volumes/Task/ci_plan.env: line 3: syntax error: unexpected end of file
Here is my script : ci_post_clone.sh
#!/bin/sh
touch availCert-dev.p12
touch availCert-qa.p12
touch availCert-stage.p12
touch availCert-prod.p12
ls -la
It also shows a warning message for shebang:
The ci_post_clone.sh is executable but exited with 1 exit code. Make sure a valid shebang line is specified if the file is a script and that the interpreter specified in the shebang line is supported on Xcode Cloud.
I will be appreciative for response on this issue.
Thank You
I installed Xcode 15 without downloading iOS 17 simulator. When I opened my iOS app project in it, Xcode showed "iOS 17.0 not installed". This is as expected. My question, however, is that after I connected my phone, it's shown in "Manage run destination", but not in Xcode deployment target selection list. Does anyone know if this is as expected? Do I have to install iOS 17 simulator to get my device shown in Xcode? Thanks.
The new test report, with the automatic video recording and scrubber, is great. I'm setting up different configurations for different languages to improve localization testing, but I was wondering if it was possible to make the simulator device type part of the configuration.
For example, I'd like to have a single test plan with an "iPhone 14" test plan, an "iPad Air" test plan, etc. Then I would just press Cmd-U, and Xcode would run through each device in sequence, leaving me with videos of each test run that I could review in the test report.
Is that possible?
Hey,
I'm trying the new strings catalog, and I have a script that I would like to run on the xcstrings json.
My question is there some documentation on the json format (what keys can it have, and values)?
Also, I didn't try it yet, but what if I set for example 50 languages and 1000 localization keys, is that json really scalable? It could grow quite large, would xcode still keep it as one big file, or it would somehow split it into chunks?
Would be happy for any info from the dev teams, thanks!
Is it possible to merge or split a string catalog? It doesn't seem possible now.
The workaround i use now is eidting the xcstrings file in TextEdit.
Hi.
I want to use OSLog. It is working as expected inside my controller. I can view all details in the console and can use "jump to source" and it jumps to the source code :) NICE
If I call this inside a package in side a static func like this
Package Example:
import OSLog
class A {
static func testLog(meesage: String) {
Logger(subsystem: "Test", category: "console").info("\(message)")
}
}
I can the message inside the console but "Jump to soure" is not working. Only a ?
appears on screen.
Did I miss anything ?
Hi
Is anyone aware of a way to emulate the digital crown within the Vision Pro Simulator? I've tried various key/scrolling combinations without any luck.
I am interested to see how the progressive immersion mode works.
Thanks
Throughout the WWDC guides and videos, Apple claims existing iOS and iPadOS apps will run in the visionOS Pro Simulator "unmodified." But none of my existing UIKit apps do.
xrOS is installed and it does run for new project templates. But even after making sure "Apple Vision (Designed for iPad)" is added to my project settings, the destination never appears in the picker UI.
What is Xcode detecting? If existing apps must be using SwiftUI or somesuch, then Apple needs to state that as a requirement.
And if that is the case, is there a migration example of meeting this requirement without breaking or rewriting my apps?
According to the WWDC202310224 "Simplify distribution in Xcode and Xcode Cloud" video, there are two questions about my development process.
First, the developer must use "Development Profile" to config Signing & Capability instead of "Developer ID Application profile" for building Applications?
shown as the pictures below
Second, after build application successfully with "Development Profile", process Product -> archive will fail with "Command SetOwnerAndGroup failed with a nonzero exit code"
error message, I have no idea how to solve this problem.
Cloud you please tell me how to successfully archive the DriverKit application step by step and further directly distribute Application ?
Thanks for your helpful support.
I have chronic problems with the connection between Xcode and my phone.
I plug the phone in and Xcode says "Waiting for phone to unlock", but the phone is already unlocked. I try locking and unlocking it, but nothing happens.
If I can get past this problem by disconnection and reconnecting the phone a couple of times, it gets into the "downloading symbols" phase and never gets out of it.
Finally, even though I have checked the "Connect via network" option, it never works, and I can never connect unless I plug in the phone with a USB cord (yes, the phone and the computer are on the same Wifi network).
Some days this is just an annoyance, but some days (like today) I really need to test something on my phone for a customer who's waiting for it, and I cannot. The thing I'm trying to test involves sending text messages so I can't use the simulator or even an iPad. What can I do to debug this problem?
using #if os(visionOS) does not work in beta 2, but I have noticed in the simulator that I really need to use thicker lines and darker colors for better legibility. Is there a way to do this in beta 2 yet?
Xcode: Version 15.0 beta 2 (15A5161b)
iPhone: iOS 17.0 (21A5268h)
Run from Xcode to Simulator or my iPhone, build successfully, install failed with the same error:
My widget extension target info.plist file looks like the image below, and it worked find with all the previous Xcode version.
After adding the key NSExtensionPrincipalClass like this:
I can install my app to simaltor and my device, however, when archive and upload to the App Store (for TestFlight testing), i got another error (the first one is related to this issue, the second i could not figure out what it is):
When UICollectionViewFlowLayoutAlertForInvalidItemSize Occured
Some Log Like These Occurred, and then app crash
*** Assertion failure in void _UIGraphicsBeginImageContextWithOptions(CGSize, BOOL, CGFloat, BOOL)(), UIGraphics.m:410
crash Output
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'UIGraphicsBeginImageContext() failed to allocate CGBitampContext: size={0, 16}, scale=3.000000, bitmapInfo=0x2002. Use UIGraphicsImageRenderer to avoid this assert.'
Anyone know how to set Side By Side Comparison in the new commit UI? New UI seems to missing a lot of features like multi-select of files to discard/stage...
I'm not sure if I'm changed an unknown-to-me setting somewhere, but since this morning, after profiling an app (metal, allocations, etc), every project I run/build on Xcode 15b3, either on simulator or on device, displays partially-alpha images blended to black, as if there was some problem in the process of compiling the PNGs (lack of premultiplying, color space, etc).
If I open those same projects on Xcode 14, they are displayed everything as they should.
Also, If I open them on other computers with Xcode 15b3 other than mine, it also works fine. And it was working fine for me this morning as well, but not anymore.
I've tried uninstalling Xcode beta and the simulator a few times, cleaning folders and preferences, hoping it was some setting I changed by mistake with some hotkey, but no luck so far.
I'll attach two pictures, one from Xcode 14, and the other one from Xcode 15b3, hoping it's some silly thing I'm missing.
xc15b3:
xc14:
Hello,
In WidgetKit, I have to write multiple #Preview macros for each family the widget supports. So is there any better way to write the #Preview?
(Although I can use the legacy PreviewProvider but it does not support timeline to test transition animation.)
#import WidgetKit
#import SwiftUI
struct DailyCaffeineWidget: Widget {
...
}
@available(iOS 17.0, *)
#Preview("Inline", as: .accessoryInline) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
@available(iOS 17.0, *)
#Preview("Circular", as: .accessoryCircular) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
@available(iOS 17.0, *)
#Preview("Rectangular", as: .accessoryRectangular) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
@available(iOS 17.0, *)
#Preview("Small", as: .systemSmall) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
@available(iOS 17.0, *)
#Preview("Medium", as: .systemMedium) {
DailyCaffeineWidget()
} timelineProvider: {
previewTimelineProvider()
}
...
This error ( no exact matches in reference to static method 'buildExpression' ) keeps occurring in my content view on the line that states .environmentObject(registrationViewModel).
Here is the ContentView code:
import SwiftUI
struct ContentView: View {
@StateObject var viewModel = ContentViewModel()
@StateObject var registrationViewModel = RegistrationViewModel()
var body: some View {
Group {
if viewModel.userSession == nil {
LoginView()
.environmentObject(registrationViewModel)
} else if let currentUser = viewModel.currentUser {
MainTabView(user: currentUser)
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Here is the RegistrationViewModel code:
import Foundation
class RegistrationViewModel: ObservableObject {
@Published var username = ""
@Published var email = ""
@Published var password = ""
func createUser() async throws {
try await AuthService.shared.createUser(email: email, password: password, username: username)
}
}
Here is some more info about the error:
Candidate requires that 'some View' conform to 'CustomizableToolbarContent' (requirement specified as 'Content' : 'CustomizableToolbarContent')
Candidate requires that 'some View' conform to 'CustomizableToolbarContent' (requirement specified as 'Content' : 'CustomizableToolbarContent')
Candidate requires that 'some View' conform to 'TableRowContent' (requirement specified as 'Content' : 'TableRowContent')
Candidate requires that 'some View' conform to 'Commands' (requirement specified as 'Content' : 'Commands')
I have been trying to figure out this error for 2 days! Please help!
Thanks
Xcode 14 introduced some ridiculous Info.plist management bugs which are not yet fixed in Xcode 15:
The bugs are manifested in the General and Info tabs of target management:
-The Build value in the General tab is not in sync with the CFBundleVersion value in the Info tab (that is, changing the value in the General tab won't affect the Info tab and vice versa).
-The App Category value in the General tab isn't in sync with the LSApplicationCategoryType value in the Info tab.
-Additional document type properties in the Info tab cannot be added: clicking "Click here to add..." doesn't do anything.
-Document types in Info tab cannot be deleted: once you added a document type instance (even as a test) there's no way to remove it.