From f5095a860de4cd1f0e635957bed7c4b80392dac8 Mon Sep 17 00:00:00 2001 From: Geoffrey Foster Date: Sun, 2 Jun 2019 16:00:26 -0400 Subject: [PATCH] Swift 5 --- Package.swift | 11 ++++------- .../Objects/Build Phases/PBXBuildPhase.swift | 2 +- .../XcodeProject/Objects/References/PBXGroup.swift | 2 +- Sources/XcodeProject/Workspace.swift | 2 +- XcodeProject.xcodeproj/project.pbxproj | 13 +++++++------ .../xcshareddata/xcschemes/XcodeProject.xcscheme | 2 +- 6 files changed, 15 insertions(+), 17 deletions(-) diff --git a/Package.swift b/Package.swift index 5f6ee0d..080ef1d 100644 --- a/Package.swift +++ b/Package.swift @@ -1,23 +1,20 @@ -// swift-tools-version:4.2 -// The swift-tools-version declares the minimum version of Swift required to build this package. +// swift-tools-version:5.0 import PackageDescription let package = Package( name: "XcodeProject", + platforms: [ + .macOS(.v10_14) + ], products: [ - // Products define the executables and libraries produced by a package, and make them visible to other packages. .library( name: "XcodeProject", targets: ["XcodeProject"]), ], dependencies: [ - // Dependencies declare other packages that this package depends on. - // .package(url: /* package url */, from: "1.0.0"), ], targets: [ - // Targets are the basic building blocks of a package. A target can define a module or a test suite. - // Targets can depend on other targets in this package, and on products in packages which this package depends on. .target( name: "XcodeProject", dependencies: []), diff --git a/Sources/XcodeProject/Objects/Build Phases/PBXBuildPhase.swift b/Sources/XcodeProject/Objects/Build Phases/PBXBuildPhase.swift index 7b65f88..1c48a07 100644 --- a/Sources/XcodeProject/Objects/Build Phases/PBXBuildPhase.swift +++ b/Sources/XcodeProject/Objects/Build Phases/PBXBuildPhase.swift @@ -29,7 +29,7 @@ public class PBXBuildPhase: PBXObject { } public func remove(file: PBXBuildFile) { - guard let index = files.index(of: file) else { return } + guard let index = files.firstIndex(of: file) else { return } files.remove(at: index) } diff --git a/Sources/XcodeProject/Objects/References/PBXGroup.swift b/Sources/XcodeProject/Objects/References/PBXGroup.swift index 6b41b77..d43874a 100644 --- a/Sources/XcodeProject/Objects/References/PBXGroup.swift +++ b/Sources/XcodeProject/Objects/References/PBXGroup.swift @@ -54,7 +54,7 @@ public class PBXGroup: PBXReference { public func remove(child: PBXReference) { guard child.parent == self else { return } - guard let index = children.index(of: child) else { return } + guard let index = children.firstIndex(of: child) else { return } children.remove(at: index) self.child(child, didMoveTo: nil) } diff --git a/Sources/XcodeProject/Workspace.swift b/Sources/XcodeProject/Workspace.swift index 9a91e05..16675ee 100644 --- a/Sources/XcodeProject/Workspace.swift +++ b/Sources/XcodeProject/Workspace.swift @@ -26,7 +26,7 @@ extension WorkspaceItem { print(location) var scheme: String = "" var path: String = location - if let index = location.index(of: ":") { + if let index = location.firstIndex(of: ":") { scheme = String(location[..