Removed Duplication in ObjectiveClass #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The code was created for the sole purpose of showing my students, that they should think on their own instead of following thought leaders and popular bloggers, as they, while being popular, still are human and sometimes don't write that great or just plain bad and dirty code. The code prior to the pull request is a perfect example of such code because of the excess amount of duplication.
The secondary aim of refactoring was to show my students, how to use some unobvious ways of handling functions in swift, when using unsafe force-cast related code.
I've created this pull request just to check, how hacktoberfest (I really want that t-shirt, yay) reacts to rejected or ignored pull requests, as original maintainer, from what it looks, ignores pull requests from other users.
P.S. I doubt the maintainer would merge the pull request, so I didn't update to Swift 4. If accept happens for some weird reason, I would refactor it to swift 4 with pleasure.