diff --git a/.travis.yml b/.travis.yml index c40ddfe4..9dd874ca 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c # [sic]. Travis uses objective-c just to determine it needs to use the xcode cli -osx_image: xcode9.3 +osx_image: xcode10 # cache: # directories: diff --git a/Podfile b/Podfile index 350ab768..578ef36d 100644 --- a/Podfile +++ b/Podfile @@ -5,11 +5,11 @@ platform :ios, '10.2' use_frameworks! target 'Campus' do - pod 'Sweeft', :git => 'https://github.com/TG908/Sweeft.git', :branch => 'master' + pod 'Sweeft', :git => 'https://github.com/nerdsupremacist/Sweeft.git', :branch => 'master' pod 'Fuzzi', '~> 0.1.1' pod 'ASWeekSelectorView', '~> 1.0' pod 'CalendarLib', '~> 2.0' - pod 'SWXMLHash', '~> 4.6.0' + pod 'SWXMLHash', '~> 4.7.4' pod 'TKSubmitTransition', :git => 'https://github.com/entotsu/TKSubmitTransition.git', :branch => 'swift4' pod 'Kanna', '~> 4.0.0' pod 'Kingfisher', '~> 4.0' @@ -29,14 +29,10 @@ end post_install do |installer| - targets_swift_4 = ['Kanna','TKSubmitTransition','SWXMLHash','CalendarLib','ASWeekSelectorView','AYSlidingPickerView','Fuzzi'] + targets_swift_3 = ['Sweeft', 'TKSubmitTransition'] installer.pods_project.targets.each do |target| - if targets_swift_4.include? target.name - target.build_configurations.each do |config| - config.build_settings['SWIFT_VERSION'] = '4.0' - end - else + if targets_swift_3.include? target.name target.build_configurations.each do |config| config.build_settings['SWIFT_VERSION'] = '3.3' end diff --git a/Podfile.lock b/Podfile.lock index 11c56715..9a7098b7 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -3,31 +3,58 @@ PODS: - CalendarLib (2.0): - OrderedDictionary (~> 1.2) - OSCache (~> 1.2) - - Crashlytics (3.10.2): - - Fabric (~> 1.7.7) - - Fabric (1.7.7) - - Firebase (5.2.0): - - Firebase/Core (= 5.2.0) - - Firebase/Core (5.2.0): + - Crashlytics (3.10.9): + - Fabric (~> 1.7.13) + - Fabric (1.7.13) + - Firebase (5.10.0): + - Firebase/Core (= 5.10.0) + - Firebase/Core (5.10.0): - Firebase/CoreOnly - - FirebaseAnalytics (= 5.0.1) - - Firebase/CoreOnly (5.2.0): - - FirebaseCore (= 5.0.3) - - FirebaseAnalytics (5.0.1): - - FirebaseCore (~> 5.0) - - FirebaseInstanceID (~> 3.0) - - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" + - FirebaseAnalytics (= 5.2.0) + - Firebase/CoreOnly (5.10.0): + - FirebaseCore (= 5.1.5) + - FirebaseAnalytics (5.2.0): + - FirebaseCore (~> 5.1) + - FirebaseInstanceID (~> 3.2) + - GoogleAppMeasurement (~> 5.2) + - GoogleUtilities/AppDelegateSwizzler (~> 5.2) + - GoogleUtilities/MethodSwizzler (~> 5.2) + - GoogleUtilities/Network (~> 5.2) + - "GoogleUtilities/NSData+zlib (~> 5.2)" - nanopb (~> 0.3) - - FirebaseCore (5.0.3): - - "GoogleToolboxForMac/NSData+zlib (~> 2.1)" - - FirebaseInstanceID (3.1.0): - - FirebaseCore (~> 5.0) + - FirebaseCore (5.1.5): + - GoogleUtilities/Logger (~> 5.2) + - FirebaseInstanceID (3.2.2): + - FirebaseCore (~> 5.1) + - GoogleUtilities/Environment (~> 5.3) + - GoogleUtilities/UserDefaults (~> 5.3) - Fuzzi (0.1.1) - - GoogleToolboxForMac/Defines (2.1.4) - - "GoogleToolboxForMac/NSData+zlib (2.1.4)": - - GoogleToolboxForMac/Defines (= 2.1.4) - - Kanna (4.0.0) - - Kingfisher (4.8.0) + - GoogleAppMeasurement (5.2.0): + - GoogleUtilities/AppDelegateSwizzler (~> 5.2) + - GoogleUtilities/MethodSwizzler (~> 5.2) + - GoogleUtilities/Network (~> 5.2) + - "GoogleUtilities/NSData+zlib (~> 5.2)" + - nanopb (~> 0.3) + - GoogleUtilities/AppDelegateSwizzler (5.3.2): + - GoogleUtilities/Environment + - GoogleUtilities/Logger + - GoogleUtilities/Network + - GoogleUtilities/Environment (5.3.2) + - GoogleUtilities/Logger (5.3.2): + - GoogleUtilities/Environment + - GoogleUtilities/MethodSwizzler (5.3.2): + - GoogleUtilities/Logger + - GoogleUtilities/Network (5.3.2): + - GoogleUtilities/Logger + - "GoogleUtilities/NSData+zlib" + - GoogleUtilities/Reachability + - "GoogleUtilities/NSData+zlib (5.3.2)" + - GoogleUtilities/Reachability (5.3.2): + - GoogleUtilities/Logger + - GoogleUtilities/UserDefaults (5.3.2): + - GoogleUtilities/Logger + - Kanna (4.0.2) + - Kingfisher (4.10.0) - nanopb (0.3.8): - nanopb/decode (= 0.3.8) - nanopb/encode (= 0.3.8) @@ -35,8 +62,8 @@ PODS: - nanopb/encode (0.3.8) - OrderedDictionary (1.4) - OSCache (1.2.1) - - Sweeft (0.15.3) - - SWXMLHash (4.6.0) + - Sweeft (0.15.2) + - SWXMLHash (4.7.4) - TKSubmitTransition (2.0) DEPENDENCIES: @@ -48,8 +75,8 @@ DEPENDENCIES: - Fuzzi (~> 0.1.1) - Kanna (~> 4.0.0) - Kingfisher (~> 4.0) - - Sweeft (from `https://github.com/TG908/Sweeft.git`, branch `master`) - - SWXMLHash (~> 4.6.0) + - Sweeft (from `https://github.com/nerdsupremacist/Sweeft.git`, branch `master`) + - SWXMLHash (~> 4.7.4) - TKSubmitTransition (from `https://github.com/entotsu/TKSubmitTransition.git`, branch `swift4`) SPEC REPOS: @@ -63,7 +90,8 @@ SPEC REPOS: - FirebaseCore - FirebaseInstanceID - Fuzzi - - GoogleToolboxForMac + - GoogleAppMeasurement + - GoogleUtilities - Kanna - Kingfisher - nanopb @@ -74,15 +102,15 @@ SPEC REPOS: EXTERNAL SOURCES: Sweeft: :branch: master - :git: https://github.com/TG908/Sweeft.git + :git: https://github.com/nerdsupremacist/Sweeft.git TKSubmitTransition: :branch: swift4 :git: https://github.com/entotsu/TKSubmitTransition.git CHECKOUT OPTIONS: Sweeft: - :commit: b57b02d909c7540a077314216c13b6f85ef5ecb6 - :git: https://github.com/TG908/Sweeft.git + :commit: d95af83a7abc27ffab66e076466e91f2a8f2ae49 + :git: https://github.com/nerdsupremacist/Sweeft.git TKSubmitTransition: :commit: 29fac6072451a4def5cde567075bfc62a728bb1f :git: https://github.com/entotsu/TKSubmitTransition.git @@ -90,23 +118,24 @@ CHECKOUT OPTIONS: SPEC CHECKSUMS: ASWeekSelectorView: 396acc65f14aa09441528fbd0b2ec46989d8cb4a CalendarLib: 040a8a655376581d8dc7c3c63196ddcf5223f471 - Crashlytics: 0360624eea1c978a743feddb2fb1ef8b37fb7a0d - Fabric: bda89e242bce1b7b8ab264248cf3407774ce0095 - Firebase: 25ed0412036d7d008568d1fb4d2e9d81ea8a0a2c - FirebaseAnalytics: b3628aea54c50464c32c393fb2ea032566e7ecc2 - FirebaseCore: a3c87242451633fff8490183898075ce77d168d2 - FirebaseInstanceID: 05d779cbb97bd5bd5c51a38a903fc9cfe1b2454a + Crashlytics: 55e24fc23989680285a21cb1146578d9d18e432c + Fabric: 25d0963b691fc97be566392243ff0ecef5a68338 + Firebase: 6691d47562a780c26281ce8464518faafc90c610 + FirebaseAnalytics: 831f1f127f4a75698e9875a87bf7e2668730d953 + FirebaseCore: c6079de64c1a87000e52e9b408dddcadc901177f + FirebaseInstanceID: 78ba376fcd5b94c001f9999b2cbd3d1f1e56e78d Fuzzi: be301db91f05b4d3191756601e326f5b6d500932 - GoogleToolboxForMac: 91c824d21e85b31c2aae9bb011c5027c9b4e738f - Kanna: d5ae2a26472f7e7a474e7f36a9cd8aa2c8c63ad3 - Kingfisher: 976d828df2b24834c6a3f2fc4d82cdbd26552be1 + GoogleAppMeasurement: 2b3a023a61239c8d002e6e4fcf4abce8eddce0e0 + GoogleUtilities: 82f04aeff8426309dbdbc75f6c8accd1e584a5da + Kanna: c60b61d72554bf04ed1ee074f9b379855cab4892 + Kingfisher: 43c4b802d8b5256cf1f4379e9cd10b329be6d3e2 nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3 OrderedDictionary: 138c8d2e358d3a0c9adda15c6c7db24e8e3b09e6 OSCache: 826996b68e8542a8a3d8af1ab0a0fc3070d8f357 - Sweeft: 7421bac377e41a4678cdb711822536445e404091 - SWXMLHash: 3c39a53723202800e9e1a87f14b2fe7ac1da98ec + Sweeft: 89d3d1b18635c862a6284483bae9b235a450f049 + SWXMLHash: b35739a5cfd915c3b482977aa720d6708e260a90 TKSubmitTransition: 647b907508da58ba864141e3c4382442ec536d40 -PODFILE CHECKSUM: a6f5636dd15a83683d41c36033e5697c2fcf19fa +PODFILE CHECKSUM: 226bb8c09114d5a789fb98e80c567472a1662462 COCOAPODS: 1.5.3 diff --git a/TUM Campus App.xcodeproj/project.pbxproj b/TUM Campus App.xcodeproj/project.pbxproj index 3dc21d48..4371b74b 100644 --- a/TUM Campus App.xcodeproj/project.pbxproj +++ b/TUM Campus App.xcodeproj/project.pbxproj @@ -1163,7 +1163,7 @@ 0E424F441BE16DBD00B5DFCB = { CreatedOnToolsVersion = 7.1; DevelopmentTeam = LQ83GZ8GRK; - LastSwiftMigration = 0930; + LastSwiftMigration = 1010; SystemCapabilities = { com.apple.ApplicationGroups.iOS = { enabled = 1; @@ -1173,18 +1173,18 @@ 0E424F581BE16DBE00B5DFCB = { CreatedOnToolsVersion = 7.1; DevelopmentTeam = ZGV2PY25EN; - LastSwiftMigration = 0930; + LastSwiftMigration = 1010; TestTargetID = 0E424F441BE16DBD00B5DFCB; }; 504C29281E2BBB9C007583E2 = { CreatedOnToolsVersion = 8.2.1; - LastSwiftMigration = 0930; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; TestTargetID = 0E424F441BE16DBD00B5DFCB; }; 50F798DD1E71615400FA4E49 = { CreatedOnToolsVersion = 8.2.1; - LastSwiftMigration = 0930; + LastSwiftMigration = 1010; ProvisioningStyle = Automatic; TestTargetID = 0E424F441BE16DBD00B5DFCB; }; @@ -1309,7 +1309,7 @@ "${BUILT_PRODUCTS_DIR}/ASWeekSelectorView/ASWeekSelectorView.framework", "${BUILT_PRODUCTS_DIR}/CalendarLib/CalendarLib.framework", "${BUILT_PRODUCTS_DIR}/Fuzzi/Fuzzi.framework", - "${BUILT_PRODUCTS_DIR}/GoogleToolboxForMac/GoogleToolboxForMac.framework", + "${BUILT_PRODUCTS_DIR}/GoogleUtilities/GoogleUtilities.framework", "${BUILT_PRODUCTS_DIR}/Kanna/Kanna.framework", "${BUILT_PRODUCTS_DIR}/Kingfisher/Kingfisher.framework", "${BUILT_PRODUCTS_DIR}/OSCache/OSCache.framework", @@ -1324,7 +1324,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ASWeekSelectorView.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/CalendarLib.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Fuzzi.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleToolboxForMac.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/GoogleUtilities.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kanna.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Kingfisher.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OSCache.framework", @@ -1751,8 +1751,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "TUM Campus App/TUM Campus App-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -1773,8 +1772,7 @@ PRODUCT_BUNDLE_IDENTIFIER = de.tum.campusapp; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "TUM Campus App/TUM Campus App-Bridging-Header.h"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; @@ -1788,8 +1786,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "de.tum.in.www1.ios15.TUM-Campus-AppUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_TARGET_NAME = "TUM Campus App"; USES_XCTRUNNER = YES; }; @@ -1804,8 +1801,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "de.tum.in.www1.ios15.TUM-Campus-AppUITests"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_TARGET_NAME = "TUM Campus App"; USES_XCTRUNNER = YES; }; @@ -1824,8 +1820,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "de.tum.in.www1.ios15.TUM-Campus-AppUnitTests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Campus.app/Campus"; }; name = Debug; @@ -1841,8 +1836,7 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "de.tum.in.www1.ios15.TUM-Campus-AppUnitTests"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Campus.app/Campus"; }; name = Release; @@ -1859,8 +1853,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_TARGET_NAME = Campus; }; name = Debug; @@ -1875,8 +1868,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "de.tum.in.www1.ios15.TUM-Campus-AutomatedScreenshots.AutomatedScreenshots"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; - SWIFT_SWIFT3_OBJC_INFERENCE = On; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_TARGET_NAME = Campus; }; name = Release; diff --git a/TUM Campus App.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme b/TUM Campus App.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme index 50df28f5..8c58d9f1 100644 --- a/TUM Campus App.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme +++ b/TUM Campus App.xcodeproj/xcshareddata/xcschemes/Screenshots.xcscheme @@ -1,6 +1,6 @@ Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { initFirebase() setupAppearance() conditionallyShowLoginViewController() @@ -29,7 +29,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { private func setupAppearance() { UINavigationBar.appearance().barTintColor = UIColor(red: 1, green: 1, blue: 1, alpha: 1) - UINavigationBar.appearance().titleTextAttributes = [NSAttributedStringKey.foregroundColor: Constants.tumBlue] + UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: Constants.tumBlue] UINavigationBar.appearance().tintColor = Constants.tumBlue } diff --git a/TUM Campus App/BookRentalHTML.swift b/TUM Campus App/BookRentalHTML.swift index dda54d55..1d79adb5 100644 --- a/TUM Campus App/BookRentalHTML.swift +++ b/TUM Campus App/BookRentalHTML.swift @@ -43,7 +43,7 @@ extension BookRentalHTML { return nil } if tableItems.count > 1 { - return stride(from: 0, to: tableItems.count, by: 2).flatMap { BookRental(td1: tableItems[$0], td2: tableItems[$0 + 1]) } + return stride(from: 0, to: tableItems.count, by: 2).compactMap { BookRental(td1: tableItems[$0], td2: tableItems[$0 + 1]) } } else { return .empty } diff --git a/TUM Campus App/CafeteriaConstants.swift b/TUM Campus App/CafeteriaConstants.swift index 67d448ed..48d9e6d9 100644 --- a/TUM Campus App/CafeteriaConstants.swift +++ b/TUM Campus App/CafeteriaConstants.swift @@ -117,7 +117,7 @@ enum CafeteriaConstants { let matches = regex.matches(in: output as String, options: [], range: NSMakeRange(0, output.length)) - matchedAnnotations = matches.flatMap { output.substring(with: $0.range) } + matchedAnnotations = matches.compactMap { output.substring(with: $0.range) } for match in matches { diff --git a/TUM Campus App/CafeteriaViewController.swift b/TUM Campus App/CafeteriaViewController.swift index 5bafff61..3f3d9572 100644 --- a/TUM Campus App/CafeteriaViewController.swift +++ b/TUM Campus App/CafeteriaViewController.swift @@ -78,7 +78,7 @@ extension CafeteriaViewController { super.viewDidLoad() tableView.estimatedRowHeight = tableView.rowHeight - tableView.rowHeight = UITableViewAutomaticDimension + tableView.rowHeight = UITableView.automaticDimension self.fetch() let size = CGSize(width: view.frame.width, height: 80.0) @@ -122,8 +122,8 @@ extension CafeteriaViewController: TUMPickerControllerDelegate { let maxHeight = view.frame.height - UIApplication.shared.statusBarFrame.height * 2 let heightConstraint = NSLayoutConstraint( item: pickerView.view, attribute: .height, - relatedBy: NSLayoutRelation.lessThanOrEqual, toItem: nil, - attribute: NSLayoutAttribute.notAnAttribute, multiplier: 1, constant: maxHeight) + relatedBy: NSLayoutConstraint.Relation.lessThanOrEqual, toItem: nil, + attribute: NSLayoutConstraint.Attribute.notAnAttribute, multiplier: 1, constant: maxHeight) pickerView.view.addConstraint(heightConstraint) } diff --git a/TUM Campus App/CalendarViewController.swift b/TUM Campus App/CalendarViewController.swift index 993ded41..fb8b4b5b 100644 --- a/TUM Campus App/CalendarViewController.swift +++ b/TUM Campus App/CalendarViewController.swift @@ -78,9 +78,9 @@ extension CalendarViewController { daySelector?.delegate = self daySelector?.selectedDate = .now - todayBarButton = UIBarButtonItem(title: "Today", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.showToday(_:))) - refreshBarButton = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonSystemItem.refresh, target: self, action: #selector(self.updateCalendar(_:))) - stopRefreshBarButton = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonSystemItem.stop, target: self, action: nil) + todayBarButton = UIBarButtonItem(title: "Today", style: UIBarButtonItem.Style.plain, target: self, action: #selector(self.showToday(_:))) + refreshBarButton = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonItem.SystemItem.refresh, target: self, action: #selector(self.updateCalendar(_:))) + stopRefreshBarButton = UIBarButtonItem.init(barButtonSystemItem: UIBarButtonItem.SystemItem.stop, target: self, action: nil) navigationItem.rightBarButtonItems = [refreshBarButton, todayBarButton] updateTitle(.now) diff --git a/TUM Campus App/CampusTabBarController.swift b/TUM Campus App/CampusTabBarController.swift index a56fdba6..590d16ed 100644 --- a/TUM Campus App/CampusTabBarController.swift +++ b/TUM Campus App/CampusTabBarController.swift @@ -41,7 +41,7 @@ class CampusNavigationController: UINavigationController { let loginViewController = ViewControllerProvider.loginNavigationViewController - (loginViewController.childViewControllers.first as? LoginViewController)?.manager = manager + (loginViewController.children.first as? LoginViewController)?.manager = manager manager?.config.tumOnline.onError { [weak self] error in guard case .invalidToken = error, PersistentUser.isLoggedIn else { return } diff --git a/TUM Campus App/CardViewController.swift b/TUM Campus App/CardViewController.swift index 2f97d29a..19e13870 100644 --- a/TUM Campus App/CardViewController.swift +++ b/TUM Campus App/CardViewController.swift @@ -138,7 +138,7 @@ class CardViewController: UIViewController, UICollectionViewDelegate, collectionView.delegate = self collectionView.dataSource = composedDataSource refreshControl.addTarget(self, action: #selector(CardViewController.refresh(sender:)), - for: UIControlEvents.valueChanged) + for: UIControl.Event.valueChanged) collectionView.refreshControl = refreshControl flowLayout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout definesPresentationContext = true diff --git a/TUM Campus App/DetailView.swift b/TUM Campus App/DetailView.swift index 336bb41a..9aae2460 100644 --- a/TUM Campus App/DetailView.swift +++ b/TUM Campus App/DetailView.swift @@ -20,5 +20,5 @@ import Foundation protocol DetailView { - weak var delegate: DetailViewDelegate? { get set } + var delegate: DetailViewDelegate? { get set } } diff --git a/TUM Campus App/DoneHUD.swift b/TUM Campus App/DoneHUD.swift index d40d3bcd..60813d78 100644 --- a/TUM Campus App/DoneHUD.swift +++ b/TUM Campus App/DoneHUD.swift @@ -12,11 +12,11 @@ open class DoneHUD: NSObject { fileprivate static let sharedObject = DoneHUD() let doneView = DoneView() - open static func showInView(_ view: UIView) { + public static func showInView(_ view: UIView) { DoneHUD.sharedObject.showInView(view, message: nil) } - open static func showInView(_ view: UIView, message: String?) { + public static func showInView(_ view: UIView, message: String?) { DoneHUD.sharedObject.showInView(view, message: message) } diff --git a/TUM Campus App/DoneView.swift b/TUM Campus App/DoneView.swift index 15cd5c60..fa01ca1c 100644 --- a/TUM Campus App/DoneView.swift +++ b/TUM Campus App/DoneView.swift @@ -102,8 +102,8 @@ open class DoneView: UIView { // Set default setting to line self.lineLayer.fillColor = UIColor.clear.cgColor self.lineLayer.anchorPoint = CGPoint(x: 0, y: 0) - self.lineLayer.lineJoin = kCALineJoinRound - self.lineLayer.lineCap = kCALineCapRound + self.lineLayer.lineJoin = CAShapeLayerLineJoin.round + self.lineLayer.lineCap = CAShapeLayerLineCap.round self.lineLayer.contentsScale = self.layer.contentsScale self.lineLayer.lineWidth = 8 self.lineLayer.strokeColor = UIColor.black.cgColor diff --git a/TUM Campus App/EditCardsViewController.swift b/TUM Campus App/EditCardsViewController.swift index 90014d48..795030e1 100644 --- a/TUM Campus App/EditCardsViewController.swift +++ b/TUM Campus App/EditCardsViewController.swift @@ -85,7 +85,7 @@ class EditCardsViewController: UITableViewController { } override func tableView(_ tableView: UITableView, - editingStyleForRowAt indexPath: IndexPath) -> UITableViewCellEditingStyle { + editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle { switch indexPath.section { case 0: return .delete @@ -119,7 +119,7 @@ class EditCardsViewController: UITableViewController { } override func tableView(_ tableView: UITableView, - commit editingStyle: UITableViewCellEditingStyle, + commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) { switch indexPath.section { case 0: diff --git a/TUM Campus App/Extensions.swift b/TUM Campus App/Extensions.swift index 1640262f..c6dc76af 100644 --- a/TUM Campus App/Extensions.swift +++ b/TUM Campus App/Extensions.swift @@ -75,7 +75,7 @@ extension Array { extension Collection { func mapped() -> [V] { - return flatMap { $0 as? V } + return compactMap { $0 as? V } } func first(where path: KeyPath, equals value: V) -> Element? { diff --git a/TUM Campus App/LectureDetailsTableViewController.swift b/TUM Campus App/LectureDetailsTableViewController.swift index 6986f66e..e978f725 100644 --- a/TUM Campus App/LectureDetailsTableViewController.swift +++ b/TUM Campus App/LectureDetailsTableViewController.swift @@ -45,7 +45,7 @@ extension LectureDetailsTableViewController { super.viewDidLoad() tableView.estimatedRowHeight = tableView.rowHeight - tableView.rowHeight = UITableViewAutomaticDimension + tableView.rowHeight = UITableView.automaticDimension if let lectureUnwrapped = lecture as? Lecture { title = lectureUnwrapped.text diff --git a/TUM Campus App/LoginViewController.swift b/TUM Campus App/LoginViewController.swift index 5471d253..c15059aa 100644 --- a/TUM Campus App/LoginViewController.swift +++ b/TUM Campus App/LoginViewController.swift @@ -67,7 +67,7 @@ class LoginViewController: UIViewController { if text.count >= characterLimit { currentTextField.text = String(text.prefix(characterLimit)) - let substring = String(text.characters.dropFirst(characterLimit)) + let substring = String(text.dropFirst(characterLimit)) if let nextTextField = nextTextField { nextTextField.becomeFirstResponder() if !substring.isEmpty { @@ -107,7 +107,7 @@ class LoginViewController: UIViewController { private func setupLogo() { let bundle = Bundle.main - let nib = bundle.loadNibNamed("TUMLogoView", owner: nil, options: nil)?.flatMap { $0 as? TUMLogoView } + let nib = bundle.loadNibNamed("TUMLogoView", owner: nil, options: nil)?.compactMap { $0 as? TUMLogoView } guard let view = nib?.first else { return } logoView = view view.frame = CGRect(x: 0, y: 0, width: 100, height: 32) diff --git a/TUM Campus App/MVGManager.swift b/TUM Campus App/MVGManager.swift index 9817dc95..845c2c30 100644 --- a/TUM Campus App/MVGManager.swift +++ b/TUM Campus App/MVGManager.swift @@ -49,7 +49,7 @@ final class MVGManager: MemoryCachedManager, SingleItemCachedManager, CardManage func fetch() -> Response<[DetailedStation]> { return prefetch().flatMap { stations in - return stations.flatMap { station in + return stations.compactMap { station in return self.fetch(for: station).map { departures in return DetailedStation(station: station, departures: departures) } diff --git a/TUM Campus App/MovieDetailTableViewController.swift b/TUM Campus App/MovieDetailTableViewController.swift index b1381122..2338f5b8 100644 --- a/TUM Campus App/MovieDetailTableViewController.swift +++ b/TUM Campus App/MovieDetailTableViewController.swift @@ -81,7 +81,7 @@ extension MovieDetailTableViewController { override func viewDidLoad() { super.viewDidLoad() tableView.estimatedRowHeight = tableView.rowHeight - tableView.rowHeight = UITableViewAutomaticDimension + tableView.rowHeight = UITableView.automaticDimension self.fetch() } diff --git a/TUM Campus App/NewsTableViewController.swift b/TUM Campus App/NewsTableViewController.swift index 9ea569ef..7e78c110 100644 --- a/TUM Campus App/NewsTableViewController.swift +++ b/TUM Campus App/NewsTableViewController.swift @@ -37,7 +37,7 @@ class NewsTableViewController: RefreshableTableViewController, DetailView } let indexPath = IndexPath(row: index, section: 0) self.tableView.scrollToRow(at: indexPath, - at: UITableViewScrollPosition.top, + at: UITableView.ScrollPosition.top, animated: false) } } diff --git a/TUM Campus App/PersonDetailTableViewController.swift b/TUM Campus App/PersonDetailTableViewController.swift index 9effcf13..d34744bf 100644 --- a/TUM Campus App/PersonDetailTableViewController.swift +++ b/TUM Campus App/PersonDetailTableViewController.swift @@ -71,7 +71,7 @@ extension PersonDetailTableViewController { super.viewDidLoad() tableView.estimatedRowHeight = tableView.rowHeight - tableView.rowHeight = UITableViewAutomaticDimension + tableView.rowHeight = UITableView.automaticDimension title = user?.text let barItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(PersonDetailTableViewController.addContact(_:))) navigationItem.rightBarButtonItem = barItem diff --git a/TUM Campus App/RefreshableTableViewController.swift b/TUM Campus App/RefreshableTableViewController.swift index 79315aab..4cd8f612 100644 --- a/TUM Campus App/RefreshableTableViewController.swift +++ b/TUM Campus App/RefreshableTableViewController.swift @@ -48,7 +48,7 @@ class RefreshableTableViewController: UITableViewController } tableView.estimatedRowHeight = tableView.rowHeight - tableView.rowHeight = UITableViewAutomaticDimension + tableView.rowHeight = UITableView.automaticDimension tableView.tableFooterView = UIView(frame: CGRect.zero) } @@ -70,7 +70,7 @@ class RefreshableTableViewController: UITableViewController func setupTableView() { refresh.addTarget(self, action: #selector(RefreshableTableViewController.refresh(_:)), - for: UIControlEvents.valueChanged) + for: UIControl.Event.valueChanged) tableView.addSubview(refresh) definesPresentationContext = true diff --git a/TUM Campus App/RootCertificatePinningAPI.swift b/TUM Campus App/RootCertificatePinningAPI.swift index 56586b5a..78e50529 100644 --- a/TUM Campus App/RootCertificatePinningAPI.swift +++ b/TUM Campus App/RootCertificatePinningAPI.swift @@ -35,7 +35,7 @@ private func certificates(trust: SecTrust) -> [Data]? { guard certificateCount > 0 else { return nil } - let certificates = (0.. Response<[DataElement]> { let promises = cardManagers => { $0.fetchCard(skipCache: skipCache) } - return promises.bulk.map { $0.flatMap { $0 } } + return promises.bulk.map { $0.compactMap { $0 } } } func search(query: String) -> Response<[SearchResults]> { diff --git a/TUM Campus App/UserData.swift b/TUM Campus App/UserData.swift index 5f696abe..dd9e527c 100644 --- a/TUM Campus App/UserData.swift +++ b/TUM Campus App/UserData.swift @@ -94,7 +94,7 @@ final class UserData: DataElement { avatar.fetch().onResult(in: .main) { result in contact.imageData = result.value? .flatMap { $0 } - .flatMap { UIImagePNGRepresentation($0) } + .flatMap { $0.pngData() } let store = CNContactStore() let saveRequest = CNSaveRequest()