Post

Replies

Boosts

Views

Activity

Reply to Trying to better understand CGAffineTransform.... and need a bit of guidance.
If understand, you call rotate then translate ? Could you show how you create the transforms ? In your case, I think it should be: var t = CGAffineTransform.identity t = t.translatedBy(x: deltaX, y: -deltaY) t = t.rotated(by: rotation) so when you apply t = Id ° trans ° rot, you apply rot first. If you call sequentially, this may help: https://stackoverflow.com/questions/24926062/sequence-of-cgaffinetransform-on-a-single-uiview Note: I also had to test and try before getting the expected result.
Topic: Graphics & Games SubTopic: General Tags:
Jan ’25
Reply to How to drag drop to reorder items in a horizontal scroll view?
I've refined a little the demo code to better show how it works. struct ContentView: View { struct Item: Identifiable { let id = UUID() var pos: Int var value: String var color: Color var onMove: Bool = false } @State var items : [Item] = [ Item(pos: 0, value: "A", color: .blue), Item(pos: 1, value: "B", color: .red), Item(pos: 2, value: "C", color: .blue), Item(pos: 3, value: "D", color: .red), Item(pos: 4, value: "E", color: .blue), Item(pos: 5, value: "F", color: .red), Item(pos: 6, value: "G", color: .blue), Item(pos: 7, value: "H", color: .red), Item(pos: 8, value: "I", color: .blue), Item(pos: 9, value: "J", color: .red), Item(pos: 10, value: "K", color: .blue) ] // enough values to activate scroll @GestureState private var isDetectingLongPress = false @State private var completedLongPress = false @State private var activeLongPress = false @State private var itemOnMove = -1 // What item is being move ? -1 if none @State private var movingToPos = -1 // What position is it being move ? -1 if none var longPress: some Gesture { LongPressGesture(minimumDuration: 0.5) // LongPress to move, shortpress to scroll .updating($isDetectingLongPress) { currentState, gestureState, transaction in gestureState = currentState activeLongPress = true } .onEnded { finished in // Only if there was no drag self.activeLongPress = !finished } } var msg : String { if itemOnMove >= 0 && itemOnMove <= 10 { if itemOnMove == movingToPos { return "Return to position \(movingToPos+1)" // +1 to start at 1 } else { return "\(items[itemOnMove].value) On move to position \(movingToPos+1)" } } return " " } var body: some View { VStack { Text("\(msg)") ScrollView(.horizontal) { HStack(spacing: 5) { ForEach(items) { item in Rectangle() .fill(item.onMove ? .green : item.color) .frame(width:40, height:40) .border(Color.yellow, width: item.pos == movingToPos ? 3 : 0) .overlay { Text("\(item.value)") } .gesture( DragGesture(minimumDistance: 20) // Need large enough to move to start drag ; otherwise, allow scroll .onChanged { value in items[item.pos].onMove = true itemOnMove = item.pos var shift = 0 if value.translation.width > 0 { shift = Int(round(value.translation.width / 45)) // 40 width + 5 interspace } else { // round on negative is too small shift = Int(value.translation.width / 45) } movingToPos = item.pos + shift } .onEnded { value in // Need to drag beyond middle of next to effectively move var shift = 0 if value.translation.width > 0 { shift = Int(round(value.translation.width / 45)) } else { // le round du négatif est trop petit shift = Int(value.translation.width / 45) } let newPos = item.pos + shift if newPos == item.pos { // No change items[item.pos].onMove = false } else if newPos >= 0 && newPos <= 10 { let element = items.remove(at: item.pos) items.insert(element, at: newPos) items[newPos].onMove = false for itemPos in 0...10 { items[itemPos].pos = itemPos } } itemOnMove = -1 movingToPos = -1 } ) .gesture(longPress) } } } .scrollDisabled(activeLongPress) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’25
Reply to How to drag drop to reorder items in a horizontal scroll view?
The complex thing is to allow both scroll and move. I do it by using longPress for move and normal press for scrolling. Here is a code snippet: struct ContentView: View { struct Item: Identifiable { let id = UUID() var pos: Int var value: String var color: Color var onMove: Bool = false } @State var items : [Item] = [ Item(pos: 0, value: "A", color: .blue), Item(pos: 1, value: "B", color: .red), Item(pos: 2, value: "C", color: .blue), Item(pos: 3, value: "D", color: .red), Item(pos: 4, value: "E", color: .blue), Item(pos: 5, value: "F", color: .red), Item(pos: 6, value: "G", color: .blue), Item(pos: 7, value: "H", color: .red), Item(pos: 8, value: "I", color: .blue), Item(pos: 9, value: "J", color: .red), Item(pos: 10, value: "K", color: .blue)] @GestureState private var isDetectingLongPress = false @State private var completedLongPress = false @State private var activeLongPress = false var longPress: some Gesture { LongPressGesture(minimumDuration: 0.5) // LongPress to move, shortpress to scroll .updating($isDetectingLongPress) { currentState, gestureState, transaction in gestureState = currentState activeLongPress = true } .onEnded { finished in self.activeLongPress = !finished } } var body: some View { ScrollView(.horizontal) { HStack(spacing: 5) { ForEach(items) { item in Rectangle() .fill(item.onMove ? .green : item.color) .frame(width:40, height:40) .overlay { Text("\(item.value)") } .gesture( DragGesture(minimumDistance: 2) .onChanged { _ in items[item.pos].onMove = true } .onEnded { value in let shift = Int(value.translation.width / 45) // 40 width + 5 interspace let newPos = item.pos+shift if newPos >= 0 && newPos <= 7 { let element = items.remove(at: item.pos) items.insert(element, at: newPos) items[newPos].onMove = false for itemPos in 0...7 { items[itemPos].pos = itemPos } } } ) .gesture(longPress) } } } .scrollDisabled(activeLongPress) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Jan ’25
Reply to Design Minimum Functionality
It seems that equivalent information is available on most restaurants websites. So what would be the added value of your app ? I guess that's what the rejection is based on. That's what guideline 4.2 states: 4.2 Minimum Functionality Your app should include features, content, and UI that elevate it beyond a repackaged website. If your app is not particularly useful, unique, or “app-like,” it doesn’t belong on the App Store. If your App doesn’t provide some sort of lasting entertainment value or adequate utility, it may not be accepted. Some idea: help find a restaurant close to my location where waiting time is low at some time help find where affluence limited at this time find restaurant opened at a given time (late or hourly hours)
Jan ’25
Reply to What's The Difference Swift Packages Frameworks ?
There are good tutorials on the web. This one as example: https://medium.com/@dhanush_kumar/modularizing-your-ios-app-frameworks-vs-swift-package-manager-7fdf9a127261
Replies
Boosts
Views
Activity
Jan ’25
Reply to How to get iOS 16 Hello World code showing in Xcode 16
I created "Test Hello", a SwiftUI project in Xcode 16.2 (that's what you call Hello world project). I set the minimum target to 15.6 as shown below: I then tested successfully on iOS 16.0 simulator.
Replies
Boosts
Views
Activity
Jan ’25
Reply to Trying to better understand CGAffineTransform.... and need a bit of guidance.
If understand, you call rotate then translate ? Could you show how you create the transforms ? In your case, I think it should be: var t = CGAffineTransform.identity t = t.translatedBy(x: deltaX, y: -deltaY) t = t.rotated(by: rotation) so when you apply t = Id ° trans ° rot, you apply rot first. If you call sequentially, this may help: https://stackoverflow.com/questions/24926062/sequence-of-cgaffinetransform-on-a-single-uiview Note: I also had to test and try before getting the expected result.
Topic: Graphics & Games SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jan ’25
Reply to Account Pending Termination
Problem may not be related to a specific app but to some activity that occured on your account. Either what you did yourself or someone else if if gave access to other people or if you were hacked.
Replies
Boosts
Views
Activity
Jan ’25
Reply to How to drag drop to reorder items in a horizontal scroll view?
I've refined a little the demo code to better show how it works. struct ContentView: View { struct Item: Identifiable { let id = UUID() var pos: Int var value: String var color: Color var onMove: Bool = false } @State var items : [Item] = [ Item(pos: 0, value: "A", color: .blue), Item(pos: 1, value: "B", color: .red), Item(pos: 2, value: "C", color: .blue), Item(pos: 3, value: "D", color: .red), Item(pos: 4, value: "E", color: .blue), Item(pos: 5, value: "F", color: .red), Item(pos: 6, value: "G", color: .blue), Item(pos: 7, value: "H", color: .red), Item(pos: 8, value: "I", color: .blue), Item(pos: 9, value: "J", color: .red), Item(pos: 10, value: "K", color: .blue) ] // enough values to activate scroll @GestureState private var isDetectingLongPress = false @State private var completedLongPress = false @State private var activeLongPress = false @State private var itemOnMove = -1 // What item is being move ? -1 if none @State private var movingToPos = -1 // What position is it being move ? -1 if none var longPress: some Gesture { LongPressGesture(minimumDuration: 0.5) // LongPress to move, shortpress to scroll .updating($isDetectingLongPress) { currentState, gestureState, transaction in gestureState = currentState activeLongPress = true } .onEnded { finished in // Only if there was no drag self.activeLongPress = !finished } } var msg : String { if itemOnMove >= 0 && itemOnMove <= 10 { if itemOnMove == movingToPos { return "Return to position \(movingToPos+1)" // +1 to start at 1 } else { return "\(items[itemOnMove].value) On move to position \(movingToPos+1)" } } return " " } var body: some View { VStack { Text("\(msg)") ScrollView(.horizontal) { HStack(spacing: 5) { ForEach(items) { item in Rectangle() .fill(item.onMove ? .green : item.color) .frame(width:40, height:40) .border(Color.yellow, width: item.pos == movingToPos ? 3 : 0) .overlay { Text("\(item.value)") } .gesture( DragGesture(minimumDistance: 20) // Need large enough to move to start drag ; otherwise, allow scroll .onChanged { value in items[item.pos].onMove = true itemOnMove = item.pos var shift = 0 if value.translation.width > 0 { shift = Int(round(value.translation.width / 45)) // 40 width + 5 interspace } else { // round on negative is too small shift = Int(value.translation.width / 45) } movingToPos = item.pos + shift } .onEnded { value in // Need to drag beyond middle of next to effectively move var shift = 0 if value.translation.width > 0 { shift = Int(round(value.translation.width / 45)) } else { // le round du négatif est trop petit shift = Int(value.translation.width / 45) } let newPos = item.pos + shift if newPos == item.pos { // No change items[item.pos].onMove = false } else if newPos >= 0 && newPos <= 10 { let element = items.remove(at: item.pos) items.insert(element, at: newPos) items[newPos].onMove = false for itemPos in 0...10 { items[itemPos].pos = itemPos } } itemOnMove = -1 movingToPos = -1 } ) .gesture(longPress) } } } .scrollDisabled(activeLongPress) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’25
Reply to Incorrect copyright date listed on Apple App Store
When you update your app, you have in the metadata a copyright field.
Replies
Boosts
Views
Activity
Jan ’25
Reply to App Store search reports my app name as a spelling error
I searched on AppStore and found a MathAppy, it finds MathAppy 1. Is it your app ? I've tested with Autocorrection (Settings > Keyboard) Off and On. Same result.
Replies
Boosts
Views
Activity
Jan ’25
Reply to How to drag drop to reorder items in a horizontal scroll view?
The complex thing is to allow both scroll and move. I do it by using longPress for move and normal press for scrolling. Here is a code snippet: struct ContentView: View { struct Item: Identifiable { let id = UUID() var pos: Int var value: String var color: Color var onMove: Bool = false } @State var items : [Item] = [ Item(pos: 0, value: "A", color: .blue), Item(pos: 1, value: "B", color: .red), Item(pos: 2, value: "C", color: .blue), Item(pos: 3, value: "D", color: .red), Item(pos: 4, value: "E", color: .blue), Item(pos: 5, value: "F", color: .red), Item(pos: 6, value: "G", color: .blue), Item(pos: 7, value: "H", color: .red), Item(pos: 8, value: "I", color: .blue), Item(pos: 9, value: "J", color: .red), Item(pos: 10, value: "K", color: .blue)] @GestureState private var isDetectingLongPress = false @State private var completedLongPress = false @State private var activeLongPress = false var longPress: some Gesture { LongPressGesture(minimumDuration: 0.5) // LongPress to move, shortpress to scroll .updating($isDetectingLongPress) { currentState, gestureState, transaction in gestureState = currentState activeLongPress = true } .onEnded { finished in self.activeLongPress = !finished } } var body: some View { ScrollView(.horizontal) { HStack(spacing: 5) { ForEach(items) { item in Rectangle() .fill(item.onMove ? .green : item.color) .frame(width:40, height:40) .overlay { Text("\(item.value)") } .gesture( DragGesture(minimumDistance: 2) .onChanged { _ in items[item.pos].onMove = true } .onEnded { value in let shift = Int(value.translation.width / 45) // 40 width + 5 interspace let newPos = item.pos+shift if newPos >= 0 && newPos <= 7 { let element = items.remove(at: item.pos) items.insert(element, at: newPos) items[newPos].onMove = false for itemPos in 0...7 { items[itemPos].pos = itemPos } } } ) .gesture(longPress) } } } .scrollDisabled(activeLongPress) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jan ’25
Reply to Same Device Code in 2 apple phones
What device code do you speak about ? Where is it in Settings ? Could you share screenshots (of course after hiding the codes themselves).
Replies
Boosts
Views
Activity
Jan ’25
Reply to Hiding Xcode Console @ Run Time
Of course, that's only when you run on simulator. I don't know how to prevent from appearing. What you can do: set console to its minimal height (not zero) turn off the Show the console control at the bottom right. No log will appear.
Replies
Boosts
Views
Activity
Jan ’25
Reply to Skadnetwork
Welcome to the forum. You propose : report you can submit to Apple Support Who do you expect to submit ? Why don't you submit yourself ?
Replies
Boosts
Views
Activity
Jan ’25
Reply to Emergency Reset
report you can submit to Apple Support Who do you expect to submit ? Why don't you submit yourself ?
Replies
Boosts
Views
Activity
Jan ’25
Reply to Polynomial Coefficients calculation
Did you download the sample project here: https://developer.apple.com/documentation/accelerate/applying_tone_curve_adjustments_to_images Does it provide the answer ?
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Jan ’25
Reply to Apple keeps preventing us for updating our app
Did you include a detailed comment to the reviewer in submission, explaining what you say here, that you have changed the screenshots to take into account the feedback you got… May be you have a new reviewer each time who does not know the context. Putting the comment may help reviewer to get it. Wish you success. PS: what type (category) of app is it ?
Replies
Boosts
Views
Activity
Jan ’25
Reply to Design Minimum Functionality
It seems that equivalent information is available on most restaurants websites. So what would be the added value of your app ? I guess that's what the rejection is based on. That's what guideline 4.2 states: 4.2 Minimum Functionality Your app should include features, content, and UI that elevate it beyond a repackaged website. If your app is not particularly useful, unique, or “app-like,” it doesn’t belong on the App Store. If your App doesn’t provide some sort of lasting entertainment value or adequate utility, it may not be accepted. Some idea: help find a restaurant close to my location where waiting time is low at some time help find where affluence limited at this time find restaurant opened at a given time (late or hourly hours)
Replies
Boosts
Views
Activity
Jan ’25