-
Notifications
You must be signed in to change notification settings - Fork 14
Xcode updates + Persian C style loop fix. #2
Conversation
This fixes a spacing issue as well as a Swift 3 compatibility thing.
@bugKrusha looks good to me. I had to make a bunch of changes to fix some stuff that went awry with the upstream changes and this. That's all been done here, if you want to look them over and then merge the PR when you're done (or let me know if there's any changes you want me to make). |
@@ -44,7 +44,7 @@ struct CodeChallengeEntry<ChallengeType: CodeChallengeType> { | |||
let name: String | |||
|
|||
/// The block to be run to evaluate this entry. | |||
let block: (_ input: ChallengeType.InputType) -> ChallengeType.OutputType | |||
let block: (ChallengeType.InputType) -> ChallengeType.OutputType |
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.
This required change is interesting 😩
for (i, accResult) in results.enumerated() { | ||
var name = accResult.name | ||
// try to make the results line up a bit by inserting the correct amount of tabs between the name and the avg based on the maximum name length vs this name's length | ||
if name.characters.count < maxNameLength { | ||
let diff = maxNameLength - name.characters.count | ||
let tabWidth = 5 | ||
let tabsToInsert = Int(ceil(Double(diff)/Double(tabWidth))) | ||
var tabsToInsert = Int(ceil(Double(diff)/Double(tabWidth))) | ||
if diff % tabWidth == 0 { |
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.
Why was this necessary?
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.
fixes a spacing issue. When the name length was equal to the tabWidth it was only inserting 1 tab, when it should be 2.
Completely unrelated to the other changes, but I saw the problem and had to fix it 😆
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.
rather, the difference, not the name length, sorry.
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.
really I think this hack should be done using spaces, not tabs anyway, not sure why I did that that way in the first place. But I didn't wanna refactor that bad in this change
@aranasaurus looks good to me so ima merge. Thanks for taking care of this 🙌 |
Mostly automatic updates from Xcode.