worth is a positive evaluation. That means you appreciate iPhone 16 or you don't speak English correctly.
Post
Replies
Boosts
Views
Activity
I tested your code on Mac Sonoma and Xcode 16.2.
I did not notice the difference between the various cases unless I really focused to try to notice. And it is nearly imperceptible.
It seems to occur only when a new row appears at the end of scrolling.
Following on @darkpaw point, what is the unsolved user pain point, or expectation, you want to solve.
You have first to dig into the problem, to make sure its solution would have real value. Then you'll start developing.
This appears to be a known issue, depending on the color scheme used by iOS 18 for different situations. there is apparently no work around:
https://www.reddit.com/r/iphone/comments/1gginzy/color_inaccuracy_since_ios_18/?rdt=38756
I found this hint:
https://www.reddit.com/r/iOSProgramming/comments/3enzxl/background_color_for_uiview_rendering_slightly/
I tried to change the color scheme, but I did not found the right one (is it sRGB, P3, Device RGB…):
I tested on a device (iPhone XS) iOS 18.2.
I effectively notice a small difference ; hardly perceptible visually, but clear on screenshots. Bizarre.
Launch screen Main screen
So I used Digital Color meter to check.
In native values I get
Launch 255 14 27
Main 234 50 34
In P3 values I get
Launch 255 2 0
Main 234 50 34
In sRVB values I get
Launch 255 0 0
Main 255 1 0
I don't know what conclusion to draw from this however…
I tested in simulator (iOS 18.2) and do not see the difference. Could you show how you defined colors (it is really pure red in both cases, or one is systemRed for instance ?
Here the screenshots with #ff0000 (red) in both cases (Label is in a systemRed view:
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
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.
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.
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.
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)
}
}
}
When you update your app, you have in the metadata a copyright field.
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.
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)
}
}
What device code do you speak about ? Where is it in Settings ?
Could you share screenshots (of course after hiding the codes themselves).