Skip to content

Avoid warnings on Swift 5.1 - #474

Merged
pepicrft merged 1 commit into
tuist:masterfrom
giginet:avoid-warning-xcode11
Sep 16, 2019
Merged

Avoid warnings on Swift 5.1#474
pepicrft merged 1 commit into
tuist:masterfrom
giginet:avoid-warning-xcode11

Conversation

@giginet

@giginet giginet commented Sep 16, 2019

Copy link
Copy Markdown
Contributor

Short description 📝

This project raises some warnings on Xcode 11 toolchain.

$ swift build
 XcodeProj (master) ~ swift build
'XcodeProj' /Users/giginet/.ghq/github.com/tuist/XcodeProj: warning: the target name XcodeProj has different case on the filesystem and the Package.swift manifest file
'XcodeProj' /Users/giginet/.ghq/github.com/tuist/XcodeProj: warning: the target name XcodeProjTests has different case on the filesystem and the Package.swift manifest file
/Users/giginet/.ghq/github.com/tuist/XcodeProj/Sources/XcodeProj/Utils/PBXBatchUpdater.swift:122:13: warning: variable 'components' was never mutated; consider changing to 'let' constant
        var components = groupPath.components
        ~~~ ^
        let
/Users/giginet/.ghq/github.com/tuist/XcodeProj/Sources/XcodeProj/Utils/ReferenceGenerator.swift:327:37: warning: 'substring(to:)' is deprecated: Please use String slicing subscript with a 'partial range upto' operator.
            return String(reference.substring(to: reference.index(reference.startIndex, offsetBy: 24)))
                                    ^
/Users/giginet/.ghq/github.com/tuist/XcodeProj/Sources/XcodeProj/Extensions/String+md5.swift:28:32: warning: 'withUnsafeBytes' is deprecated: use `withUnsafeBytes<R>(_: (UnsafeRawBufferPointer) throws -> R) rethrows -> R` instead
            let message = data.withUnsafeBytes { bytes -> [UInt8] in
                               ^
/Users/giginet/.ghq/github.com/tuist/XcodeProj/Sources/XcodeProj/Extensions/String+md5.swift:218:17: warning: variable 'M' was never mutated; consider changing to 'let' constant
            var M = toUInt32Array(chunk)
            ~~~ ^
            let
[4/4] Merging module XcodeProj

Screen Shot 2019-09-16 at 23 35 44

Solution 📦

This PR make changes to avoid some warnings.

Implementation 👩‍💻👨‍💻

  • Use let instead of var.
  • String.substring(to:) is deprecated. Use Swift.Range instead
  • Data.withUnsafeBytes is deprecated. Use instead another overload.

@pepicrft
pepicrft merged commit 2531838 into tuist:master Sep 16, 2019
@giginet
giginet deleted the avoid-warning-xcode11 branch September 16, 2019 16:04
@giginet giginet mentioned this pull request Sep 17, 2019
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.

2 participants