Skip to content

Commit 6ffb4a4

Browse files
Merge pull request #31 from folio-sec/swift-version
Swift 5 syntax
2 parents 4cdde19 + d5db01f commit 6ffb4a4

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

Configurations/ImagePipeline.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ MODULEMAP_FILE = $(SRCROOT)/Sources/WebPDecoder/include/module.modulemap
1414
PRODUCT_BUNDLE_IDENTIFIER = com.folio-sec.$(PROJECT_NAME)
1515
PRODUCT_NAME = $(TARGET_NAME:c99extidentifier)
1616
SKIP_INSTALL = YES
17-
SWIFT_VERSION = 4.2
17+
SWIFT_VERSION = 5.0
1818
TARGETED_DEVICE_FAMILY = 1,2

Configurations/ImagePipelineTests.xcconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ IPHONEOS_DEPLOYMENT_TARGET = 10.0
77
LD_RUNPATH_SEARCH_PATHS = $(inherited) @executable_path/Frameworks @loader_path/Frameworks
88
PRODUCT_BUNDLE_IDENTIFIER = com.folio-sec.$(TARGET_NAME)
99
PRODUCT_NAME = $(TARGET_NAME)
10-
SWIFT_VERSION = 4.2
10+
SWIFT_VERSION = 5.0
1111
TARGETED_DEVICE_FAMILY = 1,2

ImagePipeline.xcodeproj/project.pbxproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1560,10 +1560,11 @@
15601560
TargetAttributes = {
15611561
140C333D21D93BD3007BDE61 = {
15621562
CreatedOnToolsVersion = 10.1;
1563-
LastSwiftMigration = 1010;
1563+
LastSwiftMigration = 1130;
15641564
};
15651565
140C334621D93BD3007BDE61 = {
15661566
CreatedOnToolsVersion = 10.1;
1567+
LastSwiftMigration = 1130;
15671568
};
15681569
};
15691570
};
@@ -1573,6 +1574,7 @@
15731574
hasScannedForEncodings = 0;
15741575
knownRegions = (
15751576
en,
1577+
Base,
15761578
);
15771579
mainGroup = 140C333421D93BD3007BDE61;
15781580
productRefGroup = 140C333F21D93BD3007BDE61 /* Products */;

Sources/ImagePipeline/ImageDecoder.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ public struct ImageDecoder: ImageDecoding {
2323
return nil
2424
}
2525

26-
return data.withUnsafeBytes { (bytes: UnsafePointer<UInt8>) in
26+
return data.withUnsafeBytes { (buffer: UnsafeRawBufferPointer) in
27+
guard let bytes = buffer.bindMemory(to: UInt8.self).baseAddress else {
28+
return nil
29+
}
30+
2731
var width: Int32 = 0
2832
var height: Int32 = 0
2933

Sources/ImagePipeline/Storage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class SQLiteStorage: Storage {
4747
do {
4848
try SQLite.execute { sqlite3_bind_text(statement, 1, url.absoluteString.cString(using: .utf8), -1, SQLITE_TRANSIENT) }
4949
try SQLite.execute { sqlite3_bind_text(statement, 2, entry.url.absoluteString.cString(using: .utf8), -1, SQLITE_TRANSIENT) }
50-
try SQLite.execute { entry.data.withUnsafeBytes { sqlite3_bind_blob(statement, 3, $0, Int32(entry.data.count), SQLITE_TRANSIENT) } }
50+
try SQLite.execute { entry.data.withUnsafeBytes { sqlite3_bind_blob(statement, 3, $0.baseAddress, Int32($0.count), SQLITE_TRANSIENT) } }
5151
if let contentType = entry.contentType {
5252
try SQLite.execute { sqlite3_bind_text(statement, 4, contentType.cString(using: .utf8), -1, SQLITE_TRANSIENT) }
5353
}

0 commit comments

Comments
 (0)