Post

Replies

Boosts

Views

Activity

Reply to Programmatically Setting Constraints for CollectionViewCell Elements
Button is inside the cell ? It should be possible. Create the constraints and define IBOutlet. Then, for cell for which you want to change the constraints, call, cell.theConstraint.constant = newValue If button is in cell, do it in the button IBAction if button outside, in anotherView, call this in the IBAction for each cell you want to modify. You get the cell with let cell = collectionView!.cellForItemAtIndexPath(indexPath)
Topic: UI Frameworks SubTopic: UIKit Tags:
Apr ’25
Reply to NSTableView.clickedRow sometimes is greater than number of rows
Do I always have to explicitly check if clickedRow is within the data source range? I would recommend to. What is surprising is to have a value of 1 if tour table has only one row. Did it have several rows at any time ? Could you detail the steps you had to get the crash you reported ? So, hard to say what the reason is. Could you show more code (such as dataSource and delegate functions of the TableView)
Topic: UI Frameworks SubTopic: AppKit Tags:
Apr ’25
Reply to SwiftUI Button is not tappable if an Image is followed in a VStack
Set the width and it works: .frame(width: 240, height: 240) Or change aspect ratio: .aspectRatio(contentMode: .fit)// .fill) Problem is that image (with fill aspect or without width) overlays the button, as you can see with this: Image(systemName: "square.and.arrow.up") .resizable() .aspectRatio(contentMode: .fill) .foregroundStyle(Color.black) .frame(height: 240) .border(Color.blue, width: 2) .clipped() .onTapGesture { print("Tapped the image") } You can visualise if you do not clip: Image(systemName: "square.and.arrow.up") .resizable() .aspectRatio(contentMode: .fill) .foregroundStyle(Color.black) .frame(height: 240) .border(Color.blue, width: 2) // .clipped()
Topic: UI Frameworks SubTopic: SwiftUI
Apr ’25
Reply to Simulate run/ bike move
Effectively, that should move: https://sarunw.com/posts/how-to-simulate-location-in-xcode-and-simulator/ But you should try with freeway drive (move will be larger and hence more visible, depending on the map scale). If you want to build your own GPX file: https://developer.apple.com/forums/thread/766507
Apr ’25
Reply to Xcode Build Failure
May be because image is upside down 😉 When you post a message, make it easy to use: image in correct orientation complete code so that one can test, in text, not only screenshot full error message Seems it is a problem to type check shelterViewModel.getShelter (row: row, column: column).productId == ViewConstants.LAYOUT_DUMMY_ what is productId type ? How are ViewConstants defined ? What is .LAYOUT_DUMMY_ ? Which type ? If it is not exactly the same as productId, then the error. Note: tests as shelterViewModel.getShelterOperationFormat() != true may be written !shelterViewModel.getShelterOperationFormat()
Apr ’25
Reply to How do I use "views" and structures / what's wrong with my code?
what's wrong with my code? Sorry to say, nearly everything. There are so many errors everywhere. You should start studying Swift first. As DarkPaw said, AI (ChatGPT or other) does not replace plain intelligence. It seems you don't even understand your own code, isn't it ? There are even many typos in code: extra } Balls[].xPosition is wrong syntax. What do you mean here ? The problem for the error message (there are likely many other) is you call for item in Balls You have to use ForEach in a view. In addition, Balls is not an array, even less an instance of array. And View struct should be outside of the class. Otherwise, how do you plan to access it ? Here is a start to correct those many errors: class Balls: Identifiable { //var color: String var xPosition: Int var yPosition: Int var xVelocity: Int var yVelocity: Int var radius: Int var gravity: CGFloat var restitution: Int var other: Balls? init(xPosition: Int, yPosition: Int, xVelocity: Int, yVelocity: Int, radius: Int, gravity: CGFloat, restitution: Int) //ADD COLOR { //self.color = color self.xPosition = xPosition self.yPosition = yPosition self.xVelocity = xVelocity self.yVelocity = yVelocity self.radius = radius self.gravity = gravity self.restitution = restitution } } struct UserView: View { let ball1: Balls = Balls (xPosition: 100, yPosition: 100, xVelocity: 3, yVelocity: 0, radius: 3, gravity: 0.3, restitution: 1) let ball2: Balls = Balls (xPosition: 200, yPosition: 50, xVelocity: -2, yVelocity: 2, radius: 3, gravity: 0.3, restitution: 1) let ball3: Balls = Balls (xPosition: 300, yPosition: 150, xVelocity: 4, yVelocity: -3, radius: 3, gravity: 0.3, restitution: 1) var timer = Timer.publish(every: 0.01, on: .main, in: .common).autoconnect() @State var balls: [Balls] init() { balls = [ball1, ball2, ball3] } var body: some View { VStack { //Background color Color.gray.edgesIgnoringSafeArea(.all) //var balls [Int] = [ball1; ball2; ball3] // for item in Balls { ForEach($balls) { $ball in // You change ball later, so a binding here Circle() .fill(Color.black) .frame(width: 50, height: 50) .position(x: CGFloat($ball.xPosition.wrappedValue), y: CGFloat($ball.yPosition.wrappedValue)) // Wrappedvalue because ball is a binding .onReceive(timer) { _ in // Need on argument in the closure // self.yVelocity += self.gravity // self refers to View, not to a ball ball.yVelocity = ball.yVelocity + Int(ball.gravity) // One is Int, the other Float. Why ? That forbids += // ball.xPosition = CGPoint(ball.xPosition + ball.xVelocity) // That's not a CGPoint, needs 2 arguments ball.xPosition = ball.xPosition + ball.xVelocity ball .yPosition = ball.yPosition + ball.yVelocity if ball.yPosition >= 500 - 25 { ball.yPosition = 500 - 25 ball.yVelocity = -ball.yVelocity * ball.restitution } if ball.xPosition <= 25 { ball.xPosition = 25 ball.xVelocity = -ball.xVelocity } if ball.xPosition >= 375 { ball.xPosition = 375 ball.xVelocity = -ball.xVelocity // I suppose that's what you mean insted of ball.velocityX } /* errrors below you'll have to correct yourself let dx: int = other.xPosition - self.xPosition let dy: int = other.yPosition - self.yPosition let distance: int = sqrt (dx * dx + dy * dy) if distance < self.radius + other.radius { self.xVelocity = -self.xVelocity * self.restitution self.yVelocity = -self.yVelocity * self.restitution other.xVelocity = -other.xVelocity * self.restitution other.yVelocity = -other.yVelocity * self.restitution } */ } } } } }
Topic: UI Frameworks SubTopic: SwiftUI
Apr ’25
Reply to 4.3a then 3.2f
What a long post just to explain your app was rejected. BTW, what is section 3.2f you refer in your title ? I do not see it in the guidelines. PS: you have posted several times for the same issue and show that you have received a confirmation by reviewer of clause 4.3. And I don't think your financial "proposal" will help in anyway, will probably have inverse effect. So it is not really useful to repeat the same message again.
Apr ’25
Reply to Programmatically Setting Constraints for CollectionViewCell Elements
Button is inside the cell ? It should be possible. Create the constraints and define IBOutlet. Then, for cell for which you want to change the constraints, call, cell.theConstraint.constant = newValue If button is in cell, do it in the button IBAction if button outside, in anotherView, call this in the IBAction for each cell you want to modify. You get the cell with let cell = collectionView!.cellForItemAtIndexPath(indexPath)
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
Apr ’25
Reply to NSTableView.clickedRow sometimes is greater than number of rows
Do I always have to explicitly check if clickedRow is within the data source range? I would recommend to. What is surprising is to have a value of 1 if tour table has only one row. Did it have several rows at any time ? Could you detail the steps you had to get the crash you reported ? So, hard to say what the reason is. Could you show more code (such as dataSource and delegate functions of the TableView)
Topic: UI Frameworks SubTopic: AppKit Tags:
Replies
Boosts
Views
Activity
Apr ’25
Reply to SwiftUI Button is not tappable if an Image is followed in a VStack
Set the width and it works: .frame(width: 240, height: 240) Or change aspect ratio: .aspectRatio(contentMode: .fit)// .fill) Problem is that image (with fill aspect or without width) overlays the button, as you can see with this: Image(systemName: "square.and.arrow.up") .resizable() .aspectRatio(contentMode: .fill) .foregroundStyle(Color.black) .frame(height: 240) .border(Color.blue, width: 2) .clipped() .onTapGesture { print("Tapped the image") } You can visualise if you do not clip: Image(systemName: "square.and.arrow.up") .resizable() .aspectRatio(contentMode: .fill) .foregroundStyle(Color.black) .frame(height: 240) .border(Color.blue, width: 2) // .clipped()
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Apr ’25
Reply to Simulate run/ bike move
Effectively, that should move: https://sarunw.com/posts/how-to-simulate-location-in-xcode-and-simulator/ But you should try with freeway drive (move will be larger and hence more visible, depending on the map scale). If you want to build your own GPX file: https://developer.apple.com/forums/thread/766507
Replies
Boosts
Views
Activity
Apr ’25
Reply to Xcode Build Failure
May be because image is upside down 😉 When you post a message, make it easy to use: image in correct orientation complete code so that one can test, in text, not only screenshot full error message Seems it is a problem to type check shelterViewModel.getShelter (row: row, column: column).productId == ViewConstants.LAYOUT_DUMMY_ what is productId type ? How are ViewConstants defined ? What is .LAYOUT_DUMMY_ ? Which type ? If it is not exactly the same as productId, then the error. Note: tests as shelterViewModel.getShelterOperationFormat() != true may be written !shelterViewModel.getShelterOperationFormat()
Replies
Boosts
Views
Activity
Apr ’25
Reply to How to screenshot?
have a look here if that can help: https://superuser.com/questions/1383379/is-there-a-way-on-macos-to-take-a-screenshot-of-a-region-and-paste-it-in-a-singl
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Apr ’25
Reply to How do I use "views" and structures / what's wrong with my code?
what's wrong with my code? Sorry to say, nearly everything. There are so many errors everywhere. You should start studying Swift first. As DarkPaw said, AI (ChatGPT or other) does not replace plain intelligence. It seems you don't even understand your own code, isn't it ? There are even many typos in code: extra } Balls[].xPosition is wrong syntax. What do you mean here ? The problem for the error message (there are likely many other) is you call for item in Balls You have to use ForEach in a view. In addition, Balls is not an array, even less an instance of array. And View struct should be outside of the class. Otherwise, how do you plan to access it ? Here is a start to correct those many errors: class Balls: Identifiable { //var color: String var xPosition: Int var yPosition: Int var xVelocity: Int var yVelocity: Int var radius: Int var gravity: CGFloat var restitution: Int var other: Balls? init(xPosition: Int, yPosition: Int, xVelocity: Int, yVelocity: Int, radius: Int, gravity: CGFloat, restitution: Int) //ADD COLOR { //self.color = color self.xPosition = xPosition self.yPosition = yPosition self.xVelocity = xVelocity self.yVelocity = yVelocity self.radius = radius self.gravity = gravity self.restitution = restitution } } struct UserView: View { let ball1: Balls = Balls (xPosition: 100, yPosition: 100, xVelocity: 3, yVelocity: 0, radius: 3, gravity: 0.3, restitution: 1) let ball2: Balls = Balls (xPosition: 200, yPosition: 50, xVelocity: -2, yVelocity: 2, radius: 3, gravity: 0.3, restitution: 1) let ball3: Balls = Balls (xPosition: 300, yPosition: 150, xVelocity: 4, yVelocity: -3, radius: 3, gravity: 0.3, restitution: 1) var timer = Timer.publish(every: 0.01, on: .main, in: .common).autoconnect() @State var balls: [Balls] init() { balls = [ball1, ball2, ball3] } var body: some View { VStack { //Background color Color.gray.edgesIgnoringSafeArea(.all) //var balls [Int] = [ball1; ball2; ball3] // for item in Balls { ForEach($balls) { $ball in // You change ball later, so a binding here Circle() .fill(Color.black) .frame(width: 50, height: 50) .position(x: CGFloat($ball.xPosition.wrappedValue), y: CGFloat($ball.yPosition.wrappedValue)) // Wrappedvalue because ball is a binding .onReceive(timer) { _ in // Need on argument in the closure // self.yVelocity += self.gravity // self refers to View, not to a ball ball.yVelocity = ball.yVelocity + Int(ball.gravity) // One is Int, the other Float. Why ? That forbids += // ball.xPosition = CGPoint(ball.xPosition + ball.xVelocity) // That's not a CGPoint, needs 2 arguments ball.xPosition = ball.xPosition + ball.xVelocity ball .yPosition = ball.yPosition + ball.yVelocity if ball.yPosition >= 500 - 25 { ball.yPosition = 500 - 25 ball.yVelocity = -ball.yVelocity * ball.restitution } if ball.xPosition <= 25 { ball.xPosition = 25 ball.xVelocity = -ball.xVelocity } if ball.xPosition >= 375 { ball.xPosition = 375 ball.xVelocity = -ball.xVelocity // I suppose that's what you mean insted of ball.velocityX } /* errrors below you'll have to correct yourself let dx: int = other.xPosition - self.xPosition let dy: int = other.yPosition - self.yPosition let distance: int = sqrt (dx * dx + dy * dy) if distance < self.radius + other.radius { self.xVelocity = -self.xVelocity * self.restitution self.yVelocity = -self.yVelocity * self.restitution other.xVelocity = -other.xVelocity * self.restitution other.yVelocity = -other.yVelocity * self.restitution } */ } } } } }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Apr ’25
Reply to 4.3a then 3.2f
What a long post just to explain your app was rejected. BTW, what is section 3.2f you refer in your title ? I do not see it in the guidelines. PS: you have posted several times for the same issue and show that you have received a confirmation by reviewer of clause 4.3. And I don't think your financial "proposal" will help in anyway, will probably have inverse effect. So it is not really useful to repeat the same message again.
Replies
Boosts
Views
Activity
Apr ’25