Skip to content

Commit be6953d

Browse files
committed
Add Swift 5 support
1 parent d6a1b68 commit be6953d

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

FastImage.xcodeproj/project.pbxproj

+11-8
Original file line numberDiff line numberDiff line change
@@ -194,26 +194,27 @@
194194
A1B48FC21A0DD89F001BB364 /* Project object */ = {
195195
isa = PBXProject;
196196
attributes = {
197-
LastUpgradeCheck = 1010;
197+
LastUpgradeCheck = 1020;
198198
ORGANIZATIONNAME = "Kyle Hickinson";
199199
TargetAttributes = {
200200
27CF938D223352940093543E = {
201201
CreatedOnToolsVersion = 10.1;
202-
LastSwiftMigration = 1010;
202+
LastSwiftMigration = 1020;
203203
ProvisioningStyle = Automatic;
204204
};
205205
A1B48FD41A0DD89F001BB364 = {
206206
CreatedOnToolsVersion = 6.1;
207-
LastSwiftMigration = 1010;
207+
LastSwiftMigration = 1020;
208208
};
209209
};
210210
};
211211
buildConfigurationList = A1B48FC51A0DD89F001BB364 /* Build configuration list for PBXProject "FastImage" */;
212212
compatibilityVersion = "Xcode 3.2";
213-
developmentRegion = English;
213+
developmentRegion = en;
214214
hasScannedForEncodings = 0;
215215
knownRegions = (
216216
en,
217+
Base,
217218
);
218219
mainGroup = A1B48FC11A0DD89F001BB364;
219220
productRefGroup = A1B48FCB1A0DD89F001BB364 /* Products */;
@@ -317,7 +318,7 @@
317318
SKIP_INSTALL = YES;
318319
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
319320
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
320-
SWIFT_VERSION = 4.2;
321+
SWIFT_VERSION = 5.0;
321322
TARGETED_DEVICE_FAMILY = "1,2";
322323
VERSIONING_SYSTEM = "apple-generic";
323324
VERSION_INFO_PREFIX = "";
@@ -364,7 +365,7 @@
364365
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
365366
SKIP_INSTALL = YES;
366367
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
367-
SWIFT_VERSION = 4.2;
368+
SWIFT_VERSION = 5.0;
368369
TARGETED_DEVICE_FAMILY = "1,2";
369370
VERSIONING_SYSTEM = "apple-generic";
370371
VERSION_INFO_PREFIX = "";
@@ -375,6 +376,7 @@
375376
isa = XCBuildConfiguration;
376377
buildSettings = {
377378
ALWAYS_SEARCH_USER_PATHS = NO;
379+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
378380
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
379381
CLANG_CXX_LIBRARY = "libc++";
380382
CLANG_ENABLE_MODULES = YES;
@@ -427,6 +429,7 @@
427429
isa = XCBuildConfiguration;
428430
buildSettings = {
429431
ALWAYS_SEARCH_USER_PATHS = NO;
432+
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
430433
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
431434
CLANG_CXX_LIBRARY = "libc++";
432435
CLANG_ENABLE_MODULES = YES;
@@ -482,7 +485,7 @@
482485
PRODUCT_BUNDLE_IDENTIFIER = "com.kylehickinson.$(PRODUCT_NAME:rfc1034identifier)";
483486
PRODUCT_NAME = "$(TARGET_NAME)";
484487
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
485-
SWIFT_VERSION = 4.2;
488+
SWIFT_VERSION = 5.0;
486489
};
487490
name = Debug;
488491
};
@@ -494,7 +497,7 @@
494497
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
495498
PRODUCT_BUNDLE_IDENTIFIER = "com.kylehickinson.$(PRODUCT_NAME:rfc1034identifier)";
496499
PRODUCT_NAME = "$(TARGET_NAME)";
497-
SWIFT_VERSION = 4.2;
500+
SWIFT_VERSION = 5.0;
498501
};
499502
name = Release;
500503
};

FastImage.xcodeproj/xcshareddata/xcschemes/FastImage.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

FastImage.xcodeproj/xcshareddata/xcschemes/FastImageTests.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1010"
3+
LastUpgradeVersion = "1020"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

FastImage/DataExtensions.swift

+2-4
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ extension Data {
2121
}
2222
func read<ResultType>(_ range: Range<Data.Index>) throws -> ResultType {
2323
if range.upperBound <= count {
24-
return subdata(in: range).withUnsafeBytes({ $0.pointee })
24+
return subdata(in: range).withUnsafeBytes { $0.load(as: ResultType.self) }
2525
}
2626
throw AccessError(range: range, data: self)
2727
}
2828
func readBytes(_ range: Range<Data.Index>) throws -> [UInt8] {
2929
if range.upperBound <= count {
30-
return subdata(in: range).withUnsafeBytes { bytes in
31-
Array(UnsafeBufferPointer(start: bytes, count: range.count / MemoryLayout<UInt8>.stride))
32-
}
30+
return subdata(in: range).withUnsafeBytes { [UInt8]($0) }
3331
}
3432
throw AccessError(range: range, data: self)
3533
}

FastImage/Size Decoders/JPGSizeDecoder.swift

+4
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ final class JPGSizeDecoder: ImageSizeDecoder {
7272
if exifString == "Exif" {
7373
let exifData = data.advanced(by: offset + 8)
7474
if let exif = try? Exif(data: exifData), imageOrientation == nil {
75+
#if swift(>=5.0)
76+
imageOrientation = exif.orientation
77+
#else
7578
imageOrientation = exif?.orientation
79+
#endif
7680
}
7781
}
7882
offset += Int(exifLength)

0 commit comments

Comments
 (0)