Migrate to Swift 5

This commit is contained in:
Wojciech Nagrodzki 2019-04-07 17:36:30 +02:00
parent b941c6d316
commit 7bb6adca44
Signed by: wnagrodzki
GPG key ID: E9D0EB0302264569
4 changed files with 10 additions and 9 deletions

View file

@ -210,10 +210,11 @@
TargetAttributes = {
2E58D35921316C3500BEF81A = {
CreatedOnToolsVersion = 10.0;
LastSwiftMigration = 1020;
};
2EBF4B392122AA34008E4117 = {
CreatedOnToolsVersion = 10.0;
LastSwiftMigration = 1000;
LastSwiftMigration = 1020;
};
};
};
@ -299,7 +300,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.wnagrodzki.UnitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@ -316,7 +317,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.wnagrodzki.UnitTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@ -452,7 +453,7 @@
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "Logger/Logger-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@ -471,7 +472,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "Logger/Logger-Bridging-Header.h";
SWIFT_VERSION = 4.2;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;

View file

@ -107,7 +107,7 @@ extension Logger {
public func log(_ message: @autoclosure () -> String, level: LogLevel, file: String = #file, line: Int = #line, function: String = #function) {
let now = Date()
let location = description(for: file, line: line, function: function)
log(time: now, level: level, location: location, message: message)
log(time: now, level: level, location: location, message: message())
}
/// Returns location in format `"<file name>:<line> <function>"`.

View file

@ -38,7 +38,7 @@ public final class AgregateLogger: Logger {
public func log(time: Date, level: LogLevel, location: String, message: @autoclosure () -> String) {
for logger in self.loggers {
logger.log(time: time, level: level, location: location, message: message)
logger.log(time: time, level: level, location: location, message: message())
}
}
}

View file

@ -39,7 +39,7 @@ class FileWriterTests: XCTestCase {
func testKeepingFileSizeLimit() throws {
let factory = FileMockFactory()
let writer = try FileWriter(fileURL: logURL, fileSizeLimit: 1, fileFactory: factory)
let data = Data(bytes: [0])
let data = Data([0])
try writer.write(data)
XCTAssertEqual(factory.mock.writtenData, data)
@ -48,7 +48,7 @@ class FileWriterTests: XCTestCase {
func testExceedingFileSizeLimit() throws {
let factory = FileMockFactory()
let writer = try FileWriter(fileURL: logURL, fileSizeLimit: 1, fileFactory: factory)
let data = Data(bytes: [0, 0])
let data = Data([0, 0])
XCTAssertThrowsError(try writer.write(data), "file size limit exceeded") { (error) in
XCTAssertTrue(error is SizeLimitedFileQuotaReached)