Commit 968e487d authored by Elias Häußler's avatar Elias Häußler 🐛

[WIP][!!!][FEATURE] Switch to Swift 4

parent aec93ad6
......@@ -193,12 +193,13 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0820;
LastUpgradeCheck = 0820;
LastUpgradeCheck = 0940;
ORGANIZATIONNAME = "Elias Häußler";
TargetAttributes = {
6401803A1E683CE10047A498 = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = M3MLKNL76N;
LastSwiftMigration = 0940;
ProvisioningStyle = Automatic;
};
};
......@@ -292,15 +293,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
......@@ -342,15 +351,23 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
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;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
......@@ -387,7 +404,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "de.elias-haeussler.MultiConvert";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
......@@ -402,7 +420,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "de.elias-haeussler.MultiConvert";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
};
name = Release;
};
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
......@@ -143,6 +143,11 @@
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
......
......@@ -52,7 +52,7 @@ class HistoryViewController: UIViewController, UITableViewDelegate, UITableViewD
// Read data
do {
return (try context.fetch(fetch) as! [History]).sorted(by: { $0.0.date?.compare($0.1.date! as Date) == .orderedDescending })
return (try context.fetch(fetch) as! [History]).sorted(by: { $0.date?.compare($1.date! as Date) == .orderedDescending })
} catch {
return []
}
......
......@@ -238,7 +238,7 @@ class MainViewController: UIViewController, UISearchBarDelegate, UITableViewDele
toConvert = nil
// Split user input
var input = searchText.characters.split { $0 == " " }.map(String.init)
var input = searchText.split { $0 == " " }.map(String.init)
// Check if user typed in number and unit without whitespace in between
for (i, inp) in input.enumerated()
......@@ -467,7 +467,7 @@ class MainViewController: UIViewController, UISearchBarDelegate, UITableViewDele
out!.text = String(describing: converted[0].output!)
}
} else {
out!.text = sender.text!.characters.count > 0 ? "Error" : ""
out!.text = sender.text!.count > 0 ? "Error" : ""
}
}
}
......@@ -751,12 +751,12 @@ class MainViewController: UIViewController, UISearchBarDelegate, UITableViewDele
searchBarTextDidBeginEditing(searchBar)
// Show or hide manual view
manualView.isHidden = searchText.characters.count > 0
manualView.isHidden = searchText.count > 0
// Show or hide cancel button
searchBar.setShowsCancelButton(searchText.characters.count > 0, animated: true)
searchBar.setShowsCancelButton(searchText.count > 0, animated: true)
if searchText.characters.count > 0
if searchText.count > 0
{
// Check if user input contains logical input
let input = checkQuickConvert(searchText) ?? 1
......@@ -805,7 +805,7 @@ class MainViewController: UIViewController, UISearchBarDelegate, UITableViewDele
func searchBarTextDidBeginEditing(_ searchBar: UISearchBar)
{
// Change nav bar button
let navItem: UIBarButtonSystemItem = (searchBar.text?.characters.count)! > 0 ? .add : .done
let navItem: UIBarButtonSystemItem = (searchBar.text?.count)! > 0 ? .add : .done
let button = UIBarButtonItem(barButtonSystemItem: navItem, target: navAddFav.target, action: navAddFav.action)
navBar.topItem?.rightBarButtonItem = button
......@@ -813,7 +813,7 @@ class MainViewController: UIViewController, UISearchBarDelegate, UITableViewDele
navAddFav = button
// User can add conversion to favorites
canAdd = (searchBar.text?.characters.count)! > 0
canAdd = (searchBar.text?.count)! > 0
}
/** Return number of sections in UITableView */
......@@ -979,7 +979,7 @@ class MainViewController: UIViewController, UISearchBarDelegate, UITableViewDele
//-- OBSERVER FUNCTIONS
/** Change constraints of UIScrollView and UITableView when keyboard did show */
func keyboardDidShow(notification: NSNotification)
@objc func keyboardDidShow(notification: NSNotification)
{
// Get user info
let userInfo = notification.userInfo! as NSDictionary
......@@ -999,7 +999,7 @@ class MainViewController: UIViewController, UISearchBarDelegate, UITableViewDele
}
/** Reset contraints of UIScrollView and UITableView after keyboard did hide */
func keyboardWillHide(notification: NSNotification)
@objc func keyboardWillHide(notification: NSNotification)
{
// Reset insets
scrollView.contentInset = UIEdgeInsets.zero
......
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