Skip to content

Commit

Permalink
Merge pull request #14 from Bunn/swift5
Browse files Browse the repository at this point in the history
Swift 5 support
  • Loading branch information
Bunn authored Oct 5, 2019
2 parents 6c37eb1 + 359c703 commit e3e5299
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
16 changes: 11 additions & 5 deletions macGist.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,19 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0900;
LastUpgradeCheck = 1100;
ORGANIZATIONNAME = "Fernando Bunn";
TargetAttributes = {
319D3B911ED501D4000D4245 = {
CreatedOnToolsVersion = 8.3.2;
LastSwiftMigration = 0900;
LastSwiftMigration = 1100;
ProvisioningStyle = Manual;
};
};
};
buildConfigurationList = 319D3B8D1ED501D4000D4245 /* Build configuration list for PBXProject "macGist" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Expand Down Expand Up @@ -303,13 +303,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -360,13 +362,15 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Expand Down Expand Up @@ -398,6 +402,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
Expand All @@ -407,14 +412,15 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
319D3BA31ED501D4000D4245 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
Expand All @@ -424,7 +430,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion macGist/Gist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct Gist: Codable {
*/
private let files: GistFiles
var gistFiles : [GistFile] {
return files.gists.flatMap{$0}
return files.gists.compactMap{$0}
}

enum CodingKeys: String, CodingKey {
Expand Down
2 changes: 1 addition & 1 deletion macGist/GitHubAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct GitHubAPI {
return
}

if let json = try? JSONSerialization.jsonObject(with: data, options: []) as! [String : Any] {
if let json = try? JSONSerialization.jsonObject(with: data, options: []) as? [String : Any] {
if let htmlURL = json["html_url"] as? String {
completion(nil, htmlURL)
}
Expand Down
2 changes: 1 addition & 1 deletion macGist/LoginViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class LoginViewController: NSViewController {
private func openTwoFactorController() {
let twoFactorController = TwoFactorViewController()
twoFactorController.delegate = self
presentViewControllerAsSheet(twoFactorController)
presentAsSheet(twoFactorController)
}

fileprivate func authenticate(twoFactorCode: String? = nil) {
Expand Down
4 changes: 2 additions & 2 deletions macGist/Menu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ enum Images {

switch self {
case .standardIcon:
image = NSImage(named: NSImage.Name(rawValue: "icon"))
image = NSImage(named: "icon")
case .checkmarkIcon:
image = NSImage(named: NSImage.Name(rawValue: "check_white_icon"))
image = NSImage(named: "check_white_icon")
}
image?.isTemplate = true
return image
Expand Down
2 changes: 1 addition & 1 deletion macGist/SettingsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SettingsViewController: NSViewController {
} else {
let loginViewController = LoginViewController()
loginViewController.delegate = self
presentViewControllerAsSheet(loginViewController)
presentAsSheet(loginViewController)
}
}
}
Expand Down

0 comments on commit e3e5299

Please sign in to comment.