Skip to content

Swift4 Fix #48 #49

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

Closed
wants to merge 6 commits into from
Closed

Swift4 Fix #48 #49

wants to merge 6 commits into from

Conversation

Ponyboy47
Copy link

  1. Removed unnecessary imports
  2. Removed _FMWrapper class and replaced with the default FileManager
  3. Implemented subscripting using new Partial Ranges
  4. Re-Implemented |>> using the TextFileStreamWriter
  5. Replaced NSString and NSData in places where String or Data would also work
  6. Added compiler flags for macOS as well as OSX, because I suspect the OSX flag will be deprecated at some point
  7. Minor work towards including Linux support
  8. Removed the _FMWrapper tests
  9. Updated swift version and FileKit version

Ponyboy47 added 2 commits July 8, 2017 12:33
1) Removed unnecessary imports
2) Removed _FMWrapper class and replaced with the default FileManager
3) Implemented subscripting using new Partial Ranges
4) Re-Implemented `|>>` using the TextFileStreamWriter
5) Replaced NSString and NSData in places where String or Data would also work
6) Added compiler flags for macOS as well as OSX, because I suspect the OSX flag will be deprecated at some point
7) Minor work towards including Linux support
8) Removed the _FMWrapper tests
9) Updated swift version and FileKit version
@Ponyboy47 Ponyboy47 mentioned this pull request Jul 8, 2017
@nvzqz
Copy link
Owner

nvzqz commented Jul 8, 2017

Awesome! I'll take a thorough look at this tonight.

@Ponyboy47
Copy link
Author

Sorry that I keep adding commits. I've been slowly refactoring stuff as I go

Copy link
Owner

@nvzqz nvzqz left a comment

Choose a reason for hiding this comment

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

I personally prefer using '///' for doc comments over block comments. Is there a reason for this change aside from it being your own preference?

@@ -917,7 +921,7 @@
PRODUCT_NAME = "$(PROJECT_NAME)";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
Copy link
Owner

Choose a reason for hiding this comment

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

I've noticed that changing the Swift version in Xcode from 3 to 4 prevents projects from compiling with Xcode 8. Until Xcode 9 is officially released and replaces Xcode 8, the Swift version in Xcode should be 3.

Copy link
Owner

@nvzqz nvzqz left a comment

Choose a reason for hiding this comment

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

Does this commit affect Swift 4 compatibility? If not, it should probably be in its own PR.

@nvzqz
Copy link
Owner

nvzqz commented Jul 16, 2017

@Ponyboy47 I've noticed that changing the Swift version in Xcode from 3 to 4 prevents projects from compiling with Xcode 8. Xcode 9 is in its third beta. When Xcode 9 hits GM or the macOS App Store, then the Swift version project setting should change to accommodate the release. Until then, it should be 3.

@phimage phimage changed the title Swift4 Swift4 Fix #48 Aug 14, 2017
@phimage phimage mentioned this pull request Aug 26, 2017
4 tasks
A representation of a filesystem array file.

The data type is NSArray.
*/
public typealias NSArrayFile = File<NSArray>
Copy link
Collaborator

@phimage phimage Aug 26, 2017

Choose a reason for hiding this comment

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

Is it a swift4 needs to change all the comments?
If not, a separated PR would have been better

  • to see only swift 4 change
  • to discuss elsewhere about comment formatting
  • to merge it before merging swift 4

Copy link
Owner

Choose a reason for hiding this comment

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

Swift 4 does not require a change in comment style. I've updated RandomKit to Swift 4 and much has remained the same as before, including the comment style.

atomically: useAuxiliaryFile,
encoding: String.Encoding.utf8.rawValue)
} catch {
else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This code do not allow to debug using a breakpoint to see the error.
Swift4 is a breaking change so I think FileKitError.writeToFileFail must contain the error as second argument

options: options)
return (volumes ?? []).flatMap { Path(url: $0) }
}

// MARK: - Properties

fileprivate var _fmWraper = _FMWrapper()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using a custom FileManager is a useful macOS feature, not really used for iOS
When you have a lot to do with files, you want to separate your FileManagerDelegate codes

public var components: [Path] {
if rawValue == "" || rawValue == "." {
guard rawValue != "" && rawValue != "." else {
Copy link
Collaborator

@phimage phimage Aug 26, 2017

Choose a reason for hiding this comment

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

guard is not always the solution

I see a lot if replaced by guard with tricky boolean conditions

it's a matter of coding style here, if has been clear here, guard also is clear

return false
}
if delim && append {
handle.write(delimData)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is a behaviour change
if append mode, you want the delim only before?
This change must be documented carefully(method comment, changelog when releasing) or be reverted

@phimage
Copy link
Collaborator

phimage commented Sep 30, 2017

Thanks @Ponyboy47. As you can see your PR could not be merged.
I convert myself to not have all comments modified.

I do some more work because of your PR like "Re-Implemented |>> using the TextFileStreamWriter"
I do not do removing import or linux stuff.
You can PR for that later

@phimage phimage closed this Sep 30, 2017
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