There were several mistakes:
[(id: String, name: String)]
This is not a good definition of a dictionary, which is just [key:value], no labels
var output = [id: "testID", name: "testName"]
It does not make sense.
If you wrote
var output = ["id": "testID", "name": "testName"]
that would be a dictionary with 2 elements, but that's not what you need here
In your loop, you replace output at each iteration. So at the end you get only the 4th input.
for i in 1...4 {
var output = [id: "testID", name: "testName"]
}
Here is a correct code. I created a type alias for better readability.
typealias MyDict = [String: String] // A dictionary is defined as [key:Value]
var quotes: [MyDict] {
var allQuotes = [MyDict]() // Creates an empty array
for i in 1...4 {
var newOutput = ["testID" : "testName \(i)", "secondID" : "secondName \(i)"] // a dict with 2 pairs allQuotes.append(newOutput) // We append the new output to the array of Dicts
}
return allQuotes
}
print(quotes)
And you get the expected array:
[["secondID": "secondName 1", "testID": "testName 1"], ["testID": "testName 2", "secondID": "secondName 2"], ["testID": "testName 3", "secondID": "secondName 3"], ["secondID": "secondName 4", "testID": "testName 4"]]
Note that as always in dictionaries, the order of pairs is never guaranteed
If you ask for an item:
print(quotes[0]["testID"])
you get an optional (as the value for the key is nil if there is no value)
Optional("testName 1")
So you should write:
print(quotes[0]["testID"] ?? "not found")
and get:
testName 1
Post
Replies
Boosts
Views
Activity
You did not give enough information on the crash. What message ? Where exactly ?
Your code is not complete to be tested:
roomOrBlank missing
I completed with:
func roomOrBlank(course: Course) -> String {
if course.room == "None" {
return ""
} else {
return course.room
}
}
currentCourse missing
Rose, Lemon, White… missing: why not pass directly a Color as parameter instead of String ?
So I tested by removing those lines and it does not crash.
struct courseListView: View {
var localcourse: Course
var localtime: String
func roomOrBlank(course: Course) -> String {
if course.room == "None" {
return ""
} else {
return course.room
}
}
var body: some View {
HStack{
Image(systemName: localcourse.listIcon)
.foregroundColor(Color(localcourse.colour))
.padding(.leading, 5)
Text(localcourse.name)
.bold()
Spacer()
Text(localtime)
Text(roomOrBlank(course: localcourse)).bold().padding(.trailing, 5)
}
.padding(.bottom, 1)
// .background(currentCourse.name==localcourse.name ? Color(localcourse.colour).colorInvert(): nil)
}
}
It does not seem the crash comes from removed line, as I tested with:
.background(false ? Color(localcourse.colour).colorInvert(): nil)
without causing a crash
Anyway, you marked your own answer as correct. As it is not really an answer, we understand you closed the thread and don't need any more help.
Welcome to the forum.
Your post does not provide enough information for anyone to help.
What is Xcord ?
Read here to know how to properly use the forum: https://developer.apple.com/forums/thread/706527
Which hours are ignored in the first case ? They all seem visible (except 24, but 24 is also 0…)
datemin and datermax seem to apply more appropriate for xAxis than yAxis.
Did you try:
Chart(...) { ... }
.chartYScale(domain: [0, 24])
Welcome to the forum.
Please note that the forum is not the channel to (try to) speak to reviewers. The appeal tou did is the right way.
When you post screenshots, please reduce their size. They are insanely large.
It seems over for a few hours (now 1 pm PST).
Did you mention it in the comments to reviewer that the app was created 13 years ago ?
However, take care that some recent features may not be considered as spam.
Did you register UserDefaults:
UserDefaults.standard.register(defaults: defaults) // connect to Root.pList
This is usually done in
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
The change itself is very simple and rapid:
archive a new build (even with no change at all in code), just change version and build numbers
in Appstore Connect, reorder the screenshots. If no new screenshot needed, it should take about 5 minutes for each localization
submit the new version.
After this there is no more work, unless the submission is rejected.
So, the raw time is very limited, less than 1 hour.
But, as @endecotp pointed out, the real workload may depend on extra tasks like testing, documenting, updating web pages for the app… Only you can know.
Did you look at this (notificatiosns with actions): https://developer.apple.com/documentation/usernotifications/handling-notifications-and-notification-related-actions
You would know if user has tapped a button (AFAIU, not if he simply discarder the notification or did not see it)
In any case, the end result (the post from "App Store Connect Engineer" is a bit nonsense and totally useless.
Have you any error message ? What type of project is it ? SwiftUI ? Other ?
Do you succeed in opening directly the .xcodeproj file ?
May have a look here: https://codecrew.codewithchris.com/t/xcode-project-xcworkspace-has-been-modified/25740
I requested that they approve my version to solve other details
I do doubt they will even consider it. You have to comply first, then they may approve.
Did you explain (in the comments to reviewer) why you think you comply ? That's the best way to get your voice heard.
If you use directly Image, it does not work. You have to use the Image built from a resized UIImage. That would be worth a bug report.
Get a solution here: https://www.hackingwithswift.com/forums/swift/remove-or-resize-an-image-when-selecting-an-item-in-a-picker-view/23940
Here is the full code.
Fiat 500e is an image in Assets
struct ContentView: View {
struct Data: Identifiable, Hashable {
var id = UUID()
var name: String
var condition: Bool
}
@State var selection = "Easy"
var datas: [Data] = [Data(name: "Easy", condition: true),
Data(name: "Medium", condition: false),
Data(name: "Hard", condition: true)]
var myImage: UIImage = UIImage(named: "Fiat 500e") ?? UIImage()
var resizedImage: UIImage {
return myImage.scalePreservingAspectRatio(targetSize: CGSize(width: 50, height: 25))
}
var body: some View {
Picker("Title: ", selection: $selection) {
ForEach(datas, id: \.self) { data in
HStack {
Text(data.name)
if data.condition {
Image(systemName: "globe")
} else {
Image(uiImage: resizedImage)
.resizable()
.scaledToFit()
}
}
.tag(data.name)
.padding()
}
}
}
}
extension UIImage {
func scalePreservingAspectRatio(targetSize: CGSize) -> UIImage {
// Determine the scale factor that preserves aspect ratio
let widthRatio = targetSize.width / size.width
let heightRatio = targetSize.height / size.height
let scaleFactor = min(widthRatio, heightRatio)
// Compute the new image size that preserves aspect ratio
let scaledImageSize = CGSize(
width: size.width * scaleFactor,
height: size.height * scaleFactor
)
// Draw and return the resized UIImage
let renderer = UIGraphicsImageRenderer(
size: scaledImageSize
)
let scaledImage = renderer.image { _ in
self.draw(in: CGRect(
origin: .zero,
size: scaledImageSize
))
}
return scaledImage
}
}
The image displayed in selection is now resized (it was automatically resized in Picker):
In Picker.
After selection.
declare quotes as a computed var
var quotes: [(quote: String, order: Int)] {
var output = [[(quote: String, order: Int)]] ()
// loop 1 to 4
// Compute each line as you do in getPrice
// append to output
return output
}