-
-
Notifications
You must be signed in to change notification settings - Fork 159
[Swift 6]: Update window system exercise #827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hello 👋 Thanks for your PR. This repo does not currently have dedicated maintainers. Our cross-track maintainers team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed. If you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track. Please feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the Exercism forum. (cc @exercism/cross-track-maintainers) |
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.
For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
Co-authored-by: Isaac Good <[email protected]>
Co-authored-by: Isaac Good <[email protected]>
Co-authored-by: Isaac Good <[email protected]>
Co-authored-by: András B Nagy <[email protected]>
|
||
Include a method `moveTo(newX:newY:)` that takes new x and y parameters and changes the properties to reflect the new position. | ||
|
||
```swift | ||
var point = Position(x: 10, y: 20) | ||
// => Position | ||
// returns Position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// returns Position | |
// Returns Position |
point.moveTo(newX: 100, newY: -100) | ||
point.y | ||
// => -100 | ||
// returns -100 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// returns -100 | |
// Returns -100 |
// returns "My First Window\nPosition: (0, 0), Size: (80 x 60)\nI 😍 my window\n" | ||
|
||
let window2 = Window(title: "My Second Window", contents: "I 😍 my window", size: Size(width: 200, height: 150), position: Position(x: 10, y: 100)) | ||
window2.display() | ||
// returns "My Second Window\nPosition: (10, 100), Size: (200 x 150)\nI 😍 my window\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// returns "My First Window\nPosition: (0, 0), Size: (80 x 60)\nI 😍 my window\n" | |
let window2 = Window(title: "My Second Window", contents: "I 😍 my window", size: Size(width: 200, height: 150), position: Position(x: 10, y: 100)) | |
window2.display() | |
// returns "My Second Window\nPosition: (10, 100), Size: (200 x 150)\nI 😍 my window\n" | |
// Returns "My First Window\nPosition: (0, 0), Size: (80 x 60)\nI 😍 my window\n" | |
let window2 = Window(title: "My Second Window", contents: "I 😍 my window", size: Size(width: 200, height: 150), position: Position(x: 10, y: 100)) | |
window2.display() | |
// Returns "My Second Window\nPosition: (10, 100), Size: (200 x 150)\nI 😍 my window\n" |
resolves #746
This removes the old closure task of the exercise, as far as I can tell is it deemed unsafe in Swift 6, and there has been several complaints about that task anyway. It is being replaced by a new initializer task instead (which is likely quite relevant to classes and struct).
TODO:
- Add proper hints file