Commit 7be063ca authored by Jü's avatar

Upgrade to Swift 5.2

fixed warnings
parent b9c169bd
......@@ -1020,12 +1020,13 @@
TargetAttributes = {
EEC9D6B320FB9D400057B9C4 = {
CreatedOnToolsVersion = 9.4.1;
DevelopmentTeam = H6QW9ES945;
DevelopmentTeam = V5D37HZ9DN;
ProvisioningStyle = Automatic;
};
EEC9D6BF20FB9D410057B9C4 = {
CreatedOnToolsVersion = 9.4.1;
DevelopmentTeam = H6QW9ES945;
DevelopmentTeam = V5D37HZ9DN;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.BackgroundModes.watchos.extension = {
......@@ -1035,13 +1036,13 @@
};
EEE1D4FD1F29153400D464C3 = {
CreatedOnToolsVersion = 8.3.3;
DevelopmentTeam = H6QW9ES945;
LastSwiftMigration = 0900;
DevelopmentTeam = V5D37HZ9DN;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
EEE1D5111F29153400D464C3 = {
CreatedOnToolsVersion = 8.3.3;
LastSwiftMigration = 0900;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
TestTargetID = EEE1D4FD1F29153400D464C3;
};
......@@ -1052,6 +1053,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
de,
);
......@@ -1360,7 +1362,7 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = H6QW9ES945;
DEVELOPMENT_TEAM = V5D37HZ9DN;
GCC_C_LANGUAGE_STANDARD = gnu11;
IBSC_MODULE = XWallet_Watchkit_App_Extension;
INFOPLIST_FILE = "XWallet Watchkit App/Info.plist";
......@@ -1370,7 +1372,7 @@
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 4.3;
WATCHOS_DEPLOYMENT_TARGET = 5.2;
};
name = Debug;
};
......@@ -1383,7 +1385,7 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = H6QW9ES945;
DEVELOPMENT_TEAM = V5D37HZ9DN;
GCC_C_LANGUAGE_STANDARD = gnu11;
IBSC_MODULE = XWallet_Watchkit_App_Extension;
INFOPLIST_FILE = "XWallet Watchkit App/Info.plist";
......@@ -1393,7 +1395,7 @@
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 4.3;
WATCHOS_DEPLOYMENT_TARGET = 5.2;
};
name = Release;
};
......@@ -1405,7 +1407,7 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = H6QW9ES945;
DEVELOPMENT_TEAM = V5D37HZ9DN;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "XWallet Watchkit App Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
......@@ -1413,9 +1415,9 @@
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 4.3;
WATCHOS_DEPLOYMENT_TARGET = 5.2;
};
name = Debug;
};
......@@ -1427,7 +1429,7 @@
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = H6QW9ES945;
DEVELOPMENT_TEAM = V5D37HZ9DN;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = "XWallet Watchkit App Extension/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
......@@ -1435,9 +1437,9 @@
PRODUCT_NAME = "${TARGET_NAME}";
SDKROOT = watchos;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 4;
WATCHOS_DEPLOYMENT_TARGET = 4.3;
WATCHOS_DEPLOYMENT_TARGET = 5.2;
};
name = Release;
};
......@@ -1559,7 +1561,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = H6QW9ES945;
DEVELOPMENT_TEAM = V5D37HZ9DN;
ENABLE_BITCODE = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
INFOPLIST_FILE = XWallet/Info.plist;
......@@ -1582,8 +1584,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "XWallet/XWallet-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
......@@ -1592,7 +1593,7 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = H6QW9ES945;
DEVELOPMENT_TEAM = V5D37HZ9DN;
ENABLE_BITCODE = NO;
GCC_SYMBOLS_PRIVATE_EXTERN = YES;
INFOPLIST_FILE = XWallet/Info.plist;
......@@ -1614,8 +1615,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.XMRSystemsLLC.XWallet;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "XWallet/XWallet-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
......@@ -1650,8 +1650,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.22of8.ch.XWalletTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "XWallet/XWallet-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XWallet.app/XWallet";
};
name = Debug;
......@@ -1687,8 +1686,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.22of8.ch.XWalletTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "XWallet/XWallet-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/XWallet.app/XWallet";
};
name = Release;
......
......@@ -26,7 +26,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var secureStore: SecureStoreProtocol!
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
if ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] != nil {
return false
......
......@@ -66,10 +66,10 @@ public class TableViewDataSource: TableViewDataSourceProtocol {
public func indexPath(forId id: String) -> IndexPath? {
guard let key = self.firstKey(forId: id) else { return nil }
guard let section = self.sectionTitles.index(of: key) else { return nil }
guard let section = self.sectionTitles.firstIndex(of: key) else { return nil }
guard let values = self.dataSource[key] else { return nil }
guard let row = values.map({ $0.id }).index(of: id) else { return nil }
guard let row = values.map({ $0.id }).firstIndex(of: id) else { return nil }
return IndexPath(row: row, section: section)
}
......
......@@ -10,7 +10,7 @@ import Foundation
public extension Constants {
public static let currencies =
static let currencies =
[
"":["EUR", "USD", "CHF", "GBP"],
"A":["AED","AFN","ALL","AMD","ANG","AOA","ARS","AUD","AWG","AZN"],
......
......@@ -17,7 +17,7 @@ public enum LanguageId: String, CaseIterable {
public extension Constants {
public static let languages =
static let languages =
[
"":LanguageId.allCases
]
......
......@@ -12,10 +12,10 @@ import UIKit
extension UIImage {
func toData() -> Data? {
if let data = UIImagePNGRepresentation(self) {
if let data = self.pngData() {
return data
}
if let data = UIImageJPEGRepresentation(self, 1.0) {
if let data = self.jpegData(compressionQuality: 1.0) {
return data
}
return nil
......
......@@ -40,7 +40,7 @@ public class Localization: Localizable {
public extension Localization {
public static func initialLanguage() -> String {
static func initialLanguage() -> String {
let preferredLanguages = Locale.preferredLanguages
let supportedLanguages = LanguageId.allCases.map { $0.rawValue }
......@@ -63,7 +63,7 @@ public extension Localization {
public extension Localization {
public func localized(_ age: FiatAge) -> String {
func localized(_ age: FiatAge) -> String {
switch age {
case .never:
return self.localized("age.never")
......@@ -82,7 +82,7 @@ public extension Localization {
public extension Localization {
public func localized(_ direction: TransactionDirection) -> String {
func localized(_ direction: TransactionDirection) -> String {
switch direction {
case .received:
return self.localized("transactionDirection.received")
......@@ -95,7 +95,7 @@ public extension Localization {
public extension Localization {
public func localized(_ languages: [String : [LanguageId]]) -> DataSourceDictionary {
func localized(_ languages: [String : [LanguageId]]) -> DataSourceDictionary {
var result = DataSourceDictionary()
for (key, value) in languages {
......
......@@ -120,10 +120,10 @@ public class MoneroUriParser: MoneroUriParserProtocol {
}
private func isValid(description: String?) -> Bool {
guard let description = description else {
// is optional
return true
}
// guard let description = description else {
// // is optional
// return true
// }
//TODO define conditions for check
return true
}
......
......@@ -58,7 +58,7 @@ public class ActivityIndicatorHUD: ActivityIndicatorHUDProtocol {
let h = self.height / 2.0
let activityIndicator = UIActivityIndicatorView(frame: CGRect(x: x, y: y, width: w, height: h))
activityIndicator.activityIndicatorViewStyle = .whiteLarge
activityIndicator.style = .whiteLarge
activityIndicator.color = UIColor.darkGray
activityIndicator.startAnimating()
......
......@@ -128,7 +128,7 @@ public class PinDotView: UIView {
private extension PinDotView {
func shakeAnimation(withDuration duration: TimeInterval, animations: @escaping () -> (), completion: @escaping () -> ()) {
UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: 0.01, initialSpringVelocity: 0.35, options: UIViewAnimationOptions(), animations: {
UIView.animate(withDuration: duration, delay: 0, usingSpringWithDamping: 0.01, initialSpringVelocity: 0.35, options: UIView.AnimationOptions(), animations: {
animations()
}) { _ in
completion()
......
......@@ -17,14 +17,14 @@ public protocol Coordinator: class {
public extension Coordinator {
public func add(childCoordinator: Coordinator) {
func add(childCoordinator: Coordinator) {
if self.childCoordinators.contains(where: { $0 === childCoordinator }) {
return
}
self.childCoordinators.append(childCoordinator)
}
public func remove(childCoordinator: Coordinator) {
func remove(childCoordinator: Coordinator) {
self.childCoordinators = self.childCoordinators.filter { $0 !== childCoordinator }
}
......
......@@ -255,7 +255,7 @@ extension SettingsCoordinator: SingleSelectionTableViewVCProtocol {
self.navigationController.popToViewController(settingsVC, animated: true)
}
var viewModel = self.makeSettingsViewModel()
let viewModel = self.makeSettingsViewModel()
self.settingsVC?.viewModel = viewModel
self.settingsVC?.refresh()
}
......
......@@ -110,11 +110,11 @@ class AmountVC: UIViewController, ActivityIndicatorProtocol {
private func registerNotificationHandlers() {
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillShow(notification:)),
name: NSNotification.Name.UIKeyboardWillShow,
name: UIResponder.keyboardWillShowNotification,
object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillHide(notification:)),
name: NSNotification.Name.UIKeyboardWillHide,
name: UIResponder.keyboardWillHideNotification,
object: nil)
}
......@@ -161,7 +161,7 @@ class AmountVC: UIViewController, ActivityIndicatorProtocol {
}
@objc func keyboardWillShow(notification: NSNotification) {
guard let keyboardFrame = notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue else {
guard let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {
return
}
let keyboardHeight = keyboardFrame.cgRectValue.height
......@@ -175,7 +175,7 @@ class AmountVC: UIViewController, ActivityIndicatorProtocol {
}
@objc func keyboardWillHide(notification: NSNotification) {
guard let keyboardFrame = notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue else {
guard let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {
return
}
let keyboardHeight = keyboardFrame.cgRectValue.height
......
......@@ -66,8 +66,8 @@ public class ScanVC: UIViewController {
}
private func showNavigationBar() {
self.view.bringSubview(toFront: self.navigationView)
self.view.bringSubview(toFront: self.navigationViewXFiller)
self.view.bringSubviewToFront(self.navigationView)
self.view.bringSubviewToFront(self.navigationViewXFiller)
}
private func updateView() {
......
......@@ -88,11 +88,11 @@ class SelectNodeVC: UIViewController {
private func registerNotificationHandlers() {
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillShow(notification:)),
name: NSNotification.Name.UIKeyboardWillShow,
name: UIResponder.keyboardWillShowNotification,
object: nil)
NotificationCenter.default.addObserver(self,
selector: #selector(keyboardWillHide(notification:)),
name: NSNotification.Name.UIKeyboardWillHide,
name: UIResponder.keyboardWillHideNotification,
object: nil)
}
......@@ -176,7 +176,7 @@ class SelectNodeVC: UIViewController {
}
@objc func keyboardWillShow(notification: NSNotification) {
guard let keyboardFrame = notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue else {
guard let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {
return
}
let keyboardHeight = keyboardFrame.cgRectValue.height
......@@ -189,7 +189,7 @@ class SelectNodeVC: UIViewController {
}
@objc func keyboardWillHide(notification: NSNotification) {
guard let keyboardFrame = notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue else {
guard let keyboardFrame = notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue else {
return
}
let keyboardHeight = keyboardFrame.cgRectValue.height
......
......@@ -275,9 +275,9 @@ extension SettingsVC: MFMailComposeViewControllerDelegate {
let alert = UIAlertController(
title: self.viewModel.emailFailedTitle ?? "!!title",
message: self.viewModel.emailFailedMessage ?? "!!message",
preferredStyle: UIAlertControllerStyle.alert)
preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: self.viewModel.ok ?? "!!OK",
style: UIAlertActionStyle.cancel,
style: UIAlertAction.Style.cancel,
handler: nil))
self.present(alert, animated: true, completion: nil)
}
......
......@@ -143,7 +143,7 @@ class WalletVC: UIViewController {
NotificationCenter.default.addObserver(self,
selector: #selector(self.willEnterForeground),
name: .UIApplicationWillEnterForeground,
name: UIApplication.willEnterForegroundNotification,
object: nil)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment