Address Swift 3.2 warnings.
PiperOrigin-RevId: 185912561
diff --git a/src/Tulsi/Base.lproj/SplashScreenWindowController.xib b/src/Tulsi/Base.lproj/SplashScreenWindowController.xib
index ecdac33..99c0754 100644
--- a/src/Tulsi/Base.lproj/SplashScreenWindowController.xib
+++ b/src/Tulsi/Base.lproj/SplashScreenWindowController.xib
@@ -1,8 +1,10 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14092" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
- <deployment version="101100" identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
+ <deployment identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14092"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+ <capability name="system font weights other than Regular or Bold" minToolsVersion="7.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SplashScreenWindowController" customModule="Tulsi" customModuleProvider="target">
@@ -16,13 +18,14 @@
<window title="Tulsi" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="TulsiSplashScreen" animationBehavior="default" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<rect key="contentRect" x="196" y="240" width="618" height="377"/>
- <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
<view key="contentView" wantsLayer="YES" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="618" height="377"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="66" horizontalPageScroll="10" verticalLineScroll="66" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lIe-Jb-eJQ">
<rect key="frame" x="302" y="0.0" width="316" height="377"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" ambiguous="YES" id="rhv-1s-qIM">
<rect key="frame" x="0.0" y="0.0" width="316" height="377"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -34,7 +37,7 @@
<color key="backgroundColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
- <tableColumn width="313" minWidth="40" maxWidth="1000" id="E0b-oY-vBl">
+ <tableColumn identifier="" width="313" minWidth="40" maxWidth="1000" id="E0b-oY-vBl">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
@@ -53,10 +56,12 @@
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="eb5-0J-vRT">
<rect key="frame" x="8" y="8" width="32" height="32"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" id="VYj-Sd-CCU"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vbY-uf-dQf">
<rect key="frame" x="48" y="8" width="159" height="32"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" allowsUndo="NO" sendsActionOnEndEditing="YES" placeholderString="Recent document name" drawsBackground="YES" id="Ed7-ov-gOg">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -92,24 +97,25 @@
</scrollView>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Cr0-BZ-yKF">
<rect key="frame" x="94" y="213" width="128" height="128"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="Wew-p3-Ia8"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gTk-1P-U8m">
<rect key="frame" x="35" y="166" width="238" height="39"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Welcome to Tulsi" id="4GE-zf-x1i">
<font key="font" metaFont="systemThin" size="32"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
- <box verticalHuggingPriority="750" fixedFrame="YES" title="Box" boxType="separator" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="YN8-Pe-4dY">
+ <box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="YN8-Pe-4dY">
<rect key="frame" x="35" y="121" width="268" height="5"/>
- <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
- <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
- <font key="titleFont" metaFont="system"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</box>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="r0o-iG-fXB">
<rect key="frame" x="35" y="141" width="238" height="17"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="center" title="Tulsi version information" usesSingleLineMode="YES" id="3kf-8j-4Yc">
<font key="font" metaFont="system"/>
<color key="textColor" name="windowFrameColor" catalog="System" colorSpace="catalog"/>
@@ -125,6 +131,7 @@
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ujV-sA-1qZ">
<rect key="frame" x="35" y="67" width="261" height="48"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="square" title="Create new project…" bezelStyle="shadowlessSquare" image="NewProject" imagePosition="left" alignment="left" state="on" imageScaling="proportionallyDown" inset="2" id="D9j-0y-ovw">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="systemBold"/>
@@ -135,6 +142,7 @@
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9Gh-jw-2TU" userLabel="Open Existing Project">
<rect key="frame" x="35" y="14" width="261" height="48"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="square" title="Open existing project…" bezelStyle="shadowlessSquare" image="OpenProject" imagePosition="left" alignment="left" state="on" imageScaling="proportionallyDown" inset="2" id="PxS-uS-IAo">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="systemBold"/>
@@ -152,7 +160,7 @@
</window>
</objects>
<resources>
- <image name="NewProject" width="48" height="48"/>
- <image name="OpenProject" width="48" height="48"/>
+ <image name="NewProject" width="512" height="512"/>
+ <image name="OpenProject" width="497" height="497"/>
</resources>
</document>
diff --git a/src/Tulsi/TulsiCommandlineParser.swift b/src/Tulsi/TulsiCommandlineParser.swift
index f654ea3..333936f 100644
--- a/src/Tulsi/TulsiCommandlineParser.swift
+++ b/src/Tulsi/TulsiCommandlineParser.swift
@@ -216,7 +216,7 @@
let pathFilters = valueString.components(separatedBy: " ").map() { path -> String in
if path.hasPrefix("//") {
- return path.substring(from: path.characters.index(path.startIndex, offsetBy: 2))
+ return path.substring(from: path.index(path.startIndex, offsetBy: 2))
}
return path
}
diff --git a/src/Tulsi/WizardSubviewProtocol.swift b/src/Tulsi/WizardSubviewProtocol.swift
index 5b748d2..b079103 100644
--- a/src/Tulsi/WizardSubviewProtocol.swift
+++ b/src/Tulsi/WizardSubviewProtocol.swift
@@ -18,7 +18,7 @@
@objc
protocol WizardSubviewProtocol {
/// Informs the receiver of the enclosing WizardViewController.
- weak var presentingWizardViewController: ConfigEditorWizardViewController? { get set }
+ var presentingWizardViewController: ConfigEditorWizardViewController? { get set }
/// Invoked when the wizard subview is about to become active due to a "next" navigation.
@objc optional func wizardSubviewWillActivateMovingForward()
diff --git a/src/TulsiGenerator/BuildLabel.swift b/src/TulsiGenerator/BuildLabel.swift
index 1254779..df5b6de 100644
--- a/src/TulsiGenerator/BuildLabel.swift
+++ b/src/TulsiGenerator/BuildLabel.swift
@@ -37,7 +37,7 @@
}
if package.hasPrefix("//") {
- package.removeSubrange(Range(package.startIndex ..< package.characters.index(package.startIndex, offsetBy: 2)))
+ package.removeSubrange(Range(package.startIndex ..< package.index(package.startIndex, offsetBy: 2)))
}
if package.isEmpty || package.hasSuffix("/") {
return ""
diff --git a/src/TulsiGenerator/PBXProjSerializer.swift b/src/TulsiGenerator/PBXProjSerializer.swift
index 55e7f57..e78851b 100644
--- a/src/TulsiGenerator/PBXProjSerializer.swift
+++ b/src/TulsiGenerator/PBXProjSerializer.swift
@@ -378,7 +378,7 @@
// string encodings vary from region to region, this representation makes the format fragile.
// You may see strings containing unreadable sequences of ASCII characters; these are used to
// represent Unicode characters.
- let valueRange = NSMakeRange(0, val.characters.count)
+ let valueRange = NSMakeRange(0, val.count)
if unquotedSerializableStringRegex.firstMatch(in: val, options: NSRegularExpression.MatchingOptions.anchored, range: valueRange) != nil {
return val
} else {
diff --git a/src/TulsiGenerator/PBXTargetGenerator.swift b/src/TulsiGenerator/PBXTargetGenerator.swift
index 862432d..f9d7baa 100644
--- a/src/TulsiGenerator/PBXTargetGenerator.swift
+++ b/src/TulsiGenerator/PBXTargetGenerator.swift
@@ -378,7 +378,7 @@
// If outputFolder contains workspaceRoot, return a relative group with the path from
// outputFolder to workspaceRoot
if workspaceRoot.hasPrefix(slashTerminatedOutputFolder) {
- let index = workspaceRoot.characters.index(workspaceRoot.startIndex, offsetBy: slashTerminatedOutputFolder.characters.count)
+ let index = workspaceRoot.index(workspaceRoot.startIndex, offsetBy: slashTerminatedOutputFolder.count)
let relativePath = workspaceRoot.substring(from: index)
return PBXGroup(name: "mainGroup",
path: relativePath,
@@ -389,7 +389,7 @@
// If workspaceRoot contains outputFolder, return a relative group using .. to walk up to
// workspaceRoot from outputFolder.
if outputFolder.hasPrefix(slashTerminatedWorkspaceRoot) {
- let index = outputFolder.characters.index(outputFolder.startIndex, offsetBy: slashTerminatedWorkspaceRoot.characters.count + 1)
+ let index = outputFolder.index(outputFolder.startIndex, offsetBy: slashTerminatedWorkspaceRoot.count + 1)
let pathToWalkBackUp = outputFolder.substring(from: index) as NSString
let numberOfDirectoriesToWalk = pathToWalkBackUp.pathComponents.count
let relativePath = [String](repeating: "..", count: numberOfDirectoriesToWalk).joined(separator: "/")
@@ -843,7 +843,7 @@
/// given set of pathFilters.
private func pathFilterFunc(_ pathFilters: Set<String>) -> (String) -> Bool {
let recursiveFilters = Set<String>(pathFilters.filter({ $0.hasSuffix("/...") }).map() {
- $0.substring(to: $0.characters.index($0.endIndex, offsetBy: -3))
+ $0.substring(to: $0.index($0.endIndex, offsetBy: -3))
})
func includePath(_ path: String) -> Bool {
@@ -1210,9 +1210,9 @@
// TODO(abaire): Add support for shell tokenization as advertised in the Bazel build
// encyclopedia.
if opt.hasPrefix("-D") {
- localDefines.insert(opt.substring(from: opt.characters.index(opt.startIndex, offsetBy: 2)))
+ localDefines.insert(opt.substring(from: opt.index(opt.startIndex, offsetBy: 2)))
} else if opt.hasPrefix("-I") {
- var path = opt.substring(from: opt.characters.index(opt.startIndex, offsetBy: 2))
+ var path = opt.substring(from: opt.index(opt.startIndex, offsetBy: 2))
if !path.hasPrefix("/") {
path = "$(\(PBXTargetGenerator.BazelWorkspaceSymlinkVarName))/\(path)"
}
@@ -1453,8 +1453,8 @@
static func indexerNameForTargetName(_ targetName: String, hash: Int, suffix: String?) -> String {
let normalizedTargetName: String
- if targetName.characters.count > MaxIndexerNameLength {
- let endIndex = targetName.characters.index(targetName.startIndex, offsetBy: MaxIndexerNameLength - 4)
+ if targetName.count > MaxIndexerNameLength {
+ let endIndex = targetName.index(targetName.startIndex, offsetBy: MaxIndexerNameLength - 4)
normalizedTargetName = targetName.substring(to: endIndex) + "_etc"
} else {
normalizedTargetName = targetName
diff --git a/src/TulsiGenerator/XcodeProjectGenerator.swift b/src/TulsiGenerator/XcodeProjectGenerator.swift
index 319465c..27582eb 100644
--- a/src/TulsiGenerator/XcodeProjectGenerator.swift
+++ b/src/TulsiGenerator/XcodeProjectGenerator.swift
@@ -1132,8 +1132,6 @@
func addPath<T: Collection>(_ pathComponents: T)
where T.SubSequence : Collection,
- T.SubSequence.Iterator.Element == T.Iterator.Element,
- T.SubSequence.SubSequence == T.SubSequence,
T.Iterator.Element == String {
guard let firstComponent = pathComponents.first else {
return
diff --git a/src/TulsiGeneratorTests/PBXTargetGeneratorTests.swift b/src/TulsiGeneratorTests/PBXTargetGeneratorTests.swift
index ec1b601..ac8e43f 100644
--- a/src/TulsiGeneratorTests/PBXTargetGeneratorTests.swift
+++ b/src/TulsiGeneratorTests/PBXTargetGeneratorTests.swift
@@ -2435,7 +2435,7 @@
XCTAssertEqual(targets.count, 1)
let resultingTarget = targets.values.first!
- XCTAssertLessThan(resultingTarget.name.characters.count, 255)
+ XCTAssertLessThan(resultingTarget.name.count, 255)
validateIndexerTarget(resultingTarget.name,
sourceFileNames: sourceFiles1,
@@ -2474,7 +2474,7 @@
XCTAssertEqual(targets.count, 1)
let resultingTarget = targets.values.first!
- XCTAssertLessThan(resultingTarget.name.characters.count, 255)
+ XCTAssertLessThan(resultingTarget.name.count, 255)
validateIndexerTarget(resultingTarget.name,
sourceFileNames: sourceFiles1 + sourceFiles2,