[Swift] Fix misleading example math and terminology in Windowing System instructions

Hi! While working on the Windowing System exercise, I noticed a couple of inaccuracies in the examples provided in instructions for resize(to:) and move(to:).

I belive that the current version mixes up variable names and produces contradictory logic based on the exercise’s default screen size (800×600).

Detailed Breakdown

1. In resize(to:) (Task 4)

Current Text:

“E.g. if the window’s position is at x = 400, y = 300 and a resize to height = 400, width = 300 is requested, then the window would be resized to height = 300, width = 300 as the screen is not large enough in the y direction to fully accommodate the request.”

The Problem: Given the screen bounds (800×600) and position (x:400,y:300):

  • Max available width: 800−400=400
  • Max available height: 600−300=300

If the request is height=400 and width=300, the requested width (300) is already well within the max allowed width (400), so it wouldn’t be clipped by boundary constraints. To demonstrate clipping on the height/Y-axis while keeping width valid, the requested width should be 400.

Suggested Correction:

“E.g. if the window’s position is at x = 400, y = 300 and a resize to width = 400, height = 400 is requested, then the window would be resized to width = 400, height = 300 as the screen is not large enough in the y direction to fully accommodate the request.”

2. In move(to:) (Task 5)

Current Text:

“E.g. if the window’s size is at x = 250, y = 100 and a move to x = 600, y = 200 is requested, then the window would be moved to x = 550, y = 200 as the screen is not large enough in the x direction to fully accommodate the request.”

The Problem: The text uses x and y to describe size. Dimensions should be represented by width and height. Here, 250 represents the window’s width used to calculate the max allowed X position (800−250=550).

Suggested Correction:

“E.g. if the window’s size is width = 250, height = 100 and a move to x = 600, y = 200 is requested, then the window would be moved to x = 550, y = 200 as the screen is not large enough in the x direction to fully accommodate the request.”

I am opening a pull request with these updates

Please don’t. The Swift track does not have a maintainer so community PRs are not being accepted.

Would you like to maintain the track? :smiley:

Available width: 400. Requested width: 300. Clipped? No. Resulting width: 300.
Available height: 300. Requested height: 400. Clipped? Yes. Resulting height: 300.

This example is showing clipping occurring on one axis but not the other. This looks correct to me.

Thank you for letting me know! I’m still learning a lot about how Exercism works and all the forum rules (apologies :sweat_smile:). I would be really happy to help maintain the track.

If you’d like to take on the role of a maintainer, you’d be committing to put in the time and work to keep the track up to date. Please make sure you first read https://exercism.org/docs/community/maintainers. If you’re unfamiliar with the Exercism setup, you’ll want to read the track docs, https://exercism.org/docs/building/tracks/.

You should also get familiar with the track repos: https://github.com/exercism/swift/ and https://github.com/exercism/swift-test-runner/. You may want to peruse the open issues and open PRs, as well as skim some prior commits to get a feel for them.

If you get through all that and still are interested in being a track maintainer, you can open a new thread volunteering to take on the job.

Lovely, I will check the docs.