Skip to content

Commit 0a006ef

Browse files
committed
Update Tools to Swift 3.1
1 parent 557e4d8 commit 0a006ef

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

Tools/main.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424

2525
import Foundation
2626

27-
extension NSOutputStream
27+
extension OutputStream
2828
{
29-
func write(string:String) {
29+
func write(_ string:String) {
3030
if string.isEmpty {return}
3131
let encodedDataArray = [UInt8](string.utf8)
3232
write(encodedDataArray, maxLength: encodedDataArray.count)
3333
}
3434
}
3535

3636

37-
func writeLicense(outstream:NSOutputStream)
37+
func writeLicense(_ outstream:OutputStream)
3838
{
3939
var s = "// WARNING: This file is generated. Modifications will be lost.\n\n"
4040
s += "// Copyright (c) 2015-2016 David Turnbull\n"
@@ -62,7 +62,7 @@ func writeLicense(outstream:NSOutputStream)
6262
}
6363

6464

65-
func writeSwizzle(out:NSOutputStream)
65+
func writeSwizzle(_ out:OutputStream)
6666
{
6767
writeLicense(out)
6868

@@ -117,22 +117,22 @@ func writeSwizzle(out:NSOutputStream)
117117
}
118118

119119

120-
func writer(filename:String, _ generator:(outstream:NSOutputStream) -> Void)
120+
func writer(_ filename:String, _ generator:(OutputStream) -> Void)
121121
{
122-
let outstream:NSOutputStream! = NSOutputStream(toFileAtPath: filename, append: false)
122+
let outstream:OutputStream! = OutputStream(toFileAtPath: filename, append: false)
123123
outstream.open()
124-
assert(outstream.streamStatus == .Open, "Unable to write \(filename)")
125-
generator(outstream: outstream)
124+
assert(outstream.streamStatus == .open, "Unable to write \(filename)")
125+
generator(outstream)
126126
outstream.close()
127127
}
128128

129129
// Got error from Xcode? Add $(SRCROOT)/Math to arguments in scheme.
130130

131-
if (Process.argc != 2) {
131+
if (CommandLine.arguments.count != 2) {
132132
print("\nusage: main.swift path_to_root\n")
133133
exit(1)
134134
}
135-
let pathPrefix = Process.arguments[1]
135+
let pathPrefix = CommandLine.arguments[1]
136136
print("Working...")
137137
writer(pathPrefix + "/Sources/Swizzle.swift", writeSwizzle)
138138
print("Success")

0 commit comments

Comments
 (0)