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 #457

Closed
wants to merge 5 commits into from
Closed

Swift 4 #457

wants to merge 5 commits into from

Conversation

lfarah
Copy link
Collaborator

@lfarah lfarah commented Sep 13, 2017

WIP branch of Swift 4. Everybody is invited to help it out.

Checklist

  • Building most extensions
  • Passing most of Tests
  • Building 100%
  • Passing all Tests
  1. We need to ensure all the extensions that were modified are being currently tested
  2. We need to ensure all tests work
  3. No extension should be removed unless there's a good reason (there's a better way to do it w/ Apple's methods)

Checklist

  • New Extension
  • New Test
  • Changed more than one extension, but all changes are related
  • Trivial change (doesn't require changelog)

Related to #456

@lfarah lfarah requested a review from Khalian September 13, 2017 01:34
@EZSwiftExtensionsBot
Copy link

EZSwiftExtensionsBot commented Sep 13, 2017

3 Errors
🚫 Making non-trivial change requires changelog entry! Please, set trivial change or add entry to changelog.
🚫 Please rebase to get rid of the merge commits in this PR
🚫 Please, modify only one extension per pull request.
2 Messages
📖 Executed 202 tests, with 0 failures (0 unexpected) in 5.037 (5.290) seconds
📖 Executed 124 tests, with 0 failures (0 unexpected) in 3.875 (3.976) seconds

Generated by 🚫 Danger

@Khalian
Copy link
Collaborator

Khalian commented Sep 13, 2017

I presume we will be putting out a swift 4.0 branch for now and not merge into master? (Until of course swift 4 is stable and not in beta)?

@lfarah
Copy link
Collaborator Author

lfarah commented Sep 13, 2017

As in today, Xcode 9 is GM so it is stable and not in beta anymore

@lfarah
Copy link
Collaborator Author

lfarah commented Sep 13, 2017

But this branch needs some work before we merge into master

let copyArray = someArray
copyArray.forEachEnumerated { XCTAssertTrue(someArray[$0.0] == $0.1) }
// copyArray.forEachEnumerated { XCTAssertTrue(someArray[$0.0] == $0.1) }
XCTFail()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets put TODOs here and everywhere else we have interjected a deliberate Fail.

let boldResult2 = NSAttributedString(string: testString2, attributes: [NSFontAttributeName: UIFont.boldSystemFont(ofSize: UIFont.systemFontSize)])
let underlineResult = NSAttributedString(string: testString, attributes: [NSUnderlineStyleAttributeName: NSUnderlineStyle.styleSingle.rawValue])
let underlineResult2 = NSAttributedString(string: testString2, attributes: [NSUnderlineStyleAttributeName: NSUnderlineStyle.styleSingle.rawValue])
let boldResult = NSAttributedString(string: testString, attributes: [NSAttributedStringKey.font: UIFont.boldSystemFont(ofSize: UIFont.systemFontSize)])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a new lint thing? Or did you interject these spaces accidentally?

self?.setScale(x: 1, y: 1)
})
}
// public func reversePop() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put a TODO here to fix this back.

@@ -609,7 +609,7 @@ extension UIView {

// MARK: Fade Extensions

private let UIViewDefaultFadeDuration: TimeInterval = 0.4
public let UIViewDefaultFadeDuration: TimeInterval = 0.4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really a swift 4.0 thing?

let size = CGSize(width: width, height: CGFloat(Double.greatestFiniteMagnitude))
return ceil((self as NSString).boundingRect(with: size, options: NSStringDrawingOptions.usesLineFragmentOrigin, attributes:attrib, context: nil).height)
}
// public func height(_ width: CGFloat, font: UIFont, lineBreakMode: NSLineBreakMode?) -> CGFloat {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put TODO here to uncomment it later on.

return nil
}
// internal func rangeFromNSRange(_ nsRange: NSRange) -> Range<String.Index>? {
// let from16 = utf16.startIndex + nsRange.location
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put TODO here and the next method that they will be uncommented later.

dictionary.forEach { (key, value) -> Void in
dictionary.forEach { (arg) -> Void in

let (key, value) = arg
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary in swift 4 syntax? IMO the earlier version looked cleaner.

@@ -220,7 +220,7 @@ extension Array where Element: Hashable {
extension Collection where Indices.Iterator.Element == Index {

/// Returns the element at the specified index if it is within bounds, otherwise nil.
public subscript (safe index: Index) -> Generator.Element? {
public subscript (safe index: Index) -> Iterator.Element? {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the difference?

@lfarah
Copy link
Collaborator Author

lfarah commented Mar 14, 2018

Alright, I made a PR based on @Steven-Cheung's PR

@lfarah lfarah mentioned this pull request Mar 14, 2018
@lfarah lfarah changed the title Swift 4 [WIP] Swift 4 Mar 22, 2018
* Fix MacOS target build error

* Fix test

* Update travis-ci xcode version

* Fix warnings
@Khalian
Copy link
Collaborator

Khalian commented Jun 30, 2018

Already done.

@Khalian Khalian closed this Jun 30, 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.

5 participants