Post

Replies

Boosts

Views

Activity

Reply to Image & Text inside picker.
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.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25
Reply to Plagiarism
Very nice. How do you use it in your app ? But effectively, I would not do it, it is too close to Apple's design and could be considered as some try to lure people into believing your app is an Apple app.
Topic: Design SubTopic: General Tags:
Feb ’25
Reply to Judge Time About Swift Student Challenge
It cannot be eliminatory, as it is not a video but depends on how the reviewer tests your app. So, as far as I understand, it is more a (strong) guideline than a requirement. My understanding is that reviewer have a limited time and may stop the test after 3 minutes. So that's you to decide to take the risk or not. But take care, it must be possible to appreciate your app in 3 minutes, even if not completely explored.
Feb ’25
Reply to Hello.
Welcome to the forum. This forum is for developers who need help or advice for developing their apps. It is not about software use, unless they are development tools. And it is not an official channel to Apple. You'd better post on the Apple Support Community: https://discussions.apple.com/welcome, or file a bug report. https://feedbackassistant.apple.com
Feb ’25
Reply to Swiftui Charts
Very strange indeed. I've tried using RuleMark as explained here: https://stackoverflow.com/questions/78873602/reverse-y-axis-of-swiftui-chart But get the same flipping. It does not occur if all values are equal but non zero: let data: [Double] = [10, 10, 10, 10, 10] Looks like a side effect of a "zero divide" (between the default minimum zero of y axis and the found max which is also 0) : when all values are equal, it wrongly computes the orientation (as you will see, chartYScale corrects this by providing the orientation). You should file a bug report. I found a solution using chartYScale: struct ChartView: View { let data: [Double] = [0, 0, 0, 0, 0] var body: some View { Chart { ForEach(data.indices, id: \.self) { index in LineMark( x: .value("Index", index), y: .value("Value", data[index]) ) } } .chartYScale(domain: [0, 50]) // <<-- Added this .chartYAxis { AxisMarks(values: [0, 10, 20, 30, 40, 50]) { value in AxisValueLabel() AxisTick() AxisGridLine() } } .padding() } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25
Reply to Repeated 4.3 Guideline Rejections After Compliance & Feature Updates
Welcome to the forum. My advice as you once experienced a rejection, is to add a comment to the reviewer, each time you submit a new version, explaining exactly what you tell here. App was once rejected under 4.3, but after adding unique features it was accepted . These included: ✅ Public tracking profiles ✅ Widgets for stats ✅ Background fetch for updates ✅ No login required That will help a new reviewer to perform an better informed review taking into account that you have corrected what caused a former rejection.
Feb ’25