Skip to content
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

Swift 4.1 / Xcode 9.3 Support #360

Merged
merged 5 commits into from
Apr 12, 2018
Merged

Swift 4.1 / Xcode 9.3 Support #360

merged 5 commits into from
Apr 12, 2018

Conversation

mattbarker016
Copy link
Contributor

Removed warnings from flatMap depreciation. Changed to compactMap

@bizz84
Copy link
Owner

bizz84 commented Apr 3, 2018

1 Error
🚫 Tests were not updated

Generated by 🚫 Danger

@mattbarker016 mattbarker016 changed the base branch from master to develop April 3, 2018 21:10
@mattbarker016
Copy link
Contributor Author

Changed branch, sorry about that! I'm guessing Travis isn't configured for Swift 4.1 for the other errors.

@bizz84
Copy link
Owner

bizz84 commented Apr 4, 2018

Will this still compile with Xcode 8 though?

Some users have not upgraded yet and I'm wary of introducing changes that may break the build on non-latest tools.

@mattbarker016
Copy link
Contributor Author

mattbarker016 commented Apr 4, 2018

Would adding if #available(iOS 11.3, *) solve it? I can try when I’m near my computer.

@AndrewBennet
Copy link

Instead of if #available(iOS 11.3, *) I think you'll want something like:

#if swift(>=4.1)
let receiptItems = nonCancelledReceiptsInfo.compactMap { ReceiptItem(receiptInfo: $0) }
#else
let receiptItems = nonCancelledReceiptsInfo.flatMap { ReceiptItem(receiptInfo: $0) }
#endif

Thanks to Andrew Bennet for suggestion!
@AndrewBennet
Copy link

Cheers for updating! There's one typo in that commit though, using compactMap in both the #if and #else cases - I left a comment.

@mattbarker016
Copy link
Contributor Author

Ugh, my bad

@AndrewBennet
Copy link

Hi @bizz84 - Can you explain what the Danger check is? Do tests need to be touched for every change?

@bizz84
Copy link
Owner

bizz84 commented Apr 12, 2018

@mattbarker016 @AndrewBennet thanks for contributing! Don't worry about the Danger check. It's not very precise.

@bizz84 bizz84 merged commit fd26b52 into bizz84:develop Apr 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants