From 89e7989abc48844c3cc8ca6c7eb4bb689bff51e1 Mon Sep 17 00:00:00 2001 From: Andrea Busi Date: Wed, 7 Oct 2020 22:00:30 +0200 Subject: [PATCH] feat: Add shadow and rounded corner to cards --- .../project.pbxproj | 12 +++-- .../Cells/AlertsNoLocationTableViewCell.swift | 2 +- .../AlertsPastEartquakesTableViewCell.swift | 2 +- .../AlertsPriorityServiceTableViewCell.swift | 2 +- ...smicNotificationCompactTableViewCell.swift | 3 +- ...micNotificationExpandedTableViewCell.swift | 3 +- ...AlertsSmartphoneNetworkTableViewCell.swift | 2 +- .../SubscriptionProductTableViewCell.swift | 2 +- .../SubscriptionsActiveTableViewCell.swift | 2 +- .../SubscriptionsHeaderTableViewCell.swift | 2 +- .../Cells/SeismicNetworkTableViewCell.swift | 8 +++- .../Storyboards/Base.lproj/Main.storyboard | 48 ++++++++++++------- Sources/Earthquake Network/UI/AppTheme.swift | 2 +- .../UI/EQNBaseTableViewCell.swift | 33 +++++++++++++ .../EQNInsetTableViewCell.swift} | 4 +- 15 files changed, 93 insertions(+), 34 deletions(-) create mode 100644 Sources/Earthquake Network/UI/EQNBaseTableViewCell.swift rename Sources/Earthquake Network/{Controllers/InApp/EQNBaseTableViewCell.swift => UI/EQNInsetTableViewCell.swift} (85%) diff --git a/Sources/Earthquake Network.xcodeproj/project.pbxproj b/Sources/Earthquake Network.xcodeproj/project.pbxproj index 53ca0dd..248d297 100644 --- a/Sources/Earthquake Network.xcodeproj/project.pbxproj +++ b/Sources/Earthquake Network.xcodeproj/project.pbxproj @@ -106,12 +106,13 @@ DC99A50324E66E270071BC9F /* EQNCommandProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC99A50224E66E270071BC9F /* EQNCommandProtocol.swift */; }; DC99A50524E66E430071BC9F /* EQNAppearanceCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC99A50424E66E430071BC9F /* EQNAppearanceCommand.swift */; }; DC99A50724E66E5F0071BC9F /* EQNStartupCommandsBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC99A50624E66E5F0071BC9F /* EQNStartupCommandsBuilder.swift */; }; + DCA5B6E7252E4BD8002AEC96 /* EQNBaseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCA5B6E6252E4BD8002AEC96 /* EQNBaseTableViewCell.swift */; }; DCAA913F24F68A1D00145A3D /* SettingMultivaluesTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCAA913E24F68A1D00145A3D /* SettingMultivaluesTableViewCell.swift */; }; DCB28CEE24FB8400001F557E /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCB28CED24FB8400001F557E /* SettingsViewController.swift */; }; DCB45BC8250E86E100DB2D0C /* SeismicSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCB45BC7250E86E100DB2D0C /* SeismicSettingsViewController.swift */; }; DCB6FBEC24D0B40600ED23B8 /* Colors.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DCB6FBEB24D0B40600ED23B8 /* Colors.xcassets */; }; DCBB267A24D1E7F500F04559 /* SubscriptionsHeaderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCBB267924D1E7F500F04559 /* SubscriptionsHeaderTableViewCell.swift */; }; - DCBB267C24D1E98300F04559 /* EQNBaseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCBB267B24D1E98300F04559 /* EQNBaseTableViewCell.swift */; }; + DCBB267C24D1E98300F04559 /* EQNInsetTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCBB267B24D1E98300F04559 /* EQNInsetTableViewCell.swift */; }; DCBB267E24D1EA2000F04559 /* SubscriptionProductTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCBB267D24D1EA2000F04559 /* SubscriptionProductTableViewCell.swift */; }; DCBB268024D1ECE200F04559 /* SubscriptionDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCBB267F24D1ECE200F04559 /* SubscriptionDetailViewController.swift */; }; DCBB84F0252CFC4600F12633 /* AlertsNoLocationTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCBB84EF252CFC4600F12633 /* AlertsNoLocationTableViewCell.swift */; }; @@ -309,12 +310,13 @@ DC99A50224E66E270071BC9F /* EQNCommandProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNCommandProtocol.swift; sourceTree = ""; }; DC99A50424E66E430071BC9F /* EQNAppearanceCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNAppearanceCommand.swift; sourceTree = ""; }; DC99A50624E66E5F0071BC9F /* EQNStartupCommandsBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNStartupCommandsBuilder.swift; sourceTree = ""; }; + DCA5B6E6252E4BD8002AEC96 /* EQNBaseTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNBaseTableViewCell.swift; sourceTree = ""; }; DCAA913E24F68A1D00145A3D /* SettingMultivaluesTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingMultivaluesTableViewCell.swift; sourceTree = ""; }; DCB28CED24FB8400001F557E /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; DCB45BC7250E86E100DB2D0C /* SeismicSettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeismicSettingsViewController.swift; sourceTree = ""; }; DCB6FBEB24D0B40600ED23B8 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; DCBB267924D1E7F500F04559 /* SubscriptionsHeaderTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionsHeaderTableViewCell.swift; sourceTree = ""; }; - DCBB267B24D1E98300F04559 /* EQNBaseTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNBaseTableViewCell.swift; sourceTree = ""; }; + DCBB267B24D1E98300F04559 /* EQNInsetTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNInsetTableViewCell.swift; sourceTree = ""; }; DCBB267D24D1EA2000F04559 /* SubscriptionProductTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionProductTableViewCell.swift; sourceTree = ""; }; DCBB267F24D1ECE200F04559 /* SubscriptionDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionDetailViewController.swift; sourceTree = ""; }; DCBB84EF252CFC4600F12633 /* AlertsNoLocationTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AlertsNoLocationTableViewCell.swift; sourceTree = ""; }; @@ -723,6 +725,8 @@ DCC23DEE24D28F58003A2404 /* EQNEdgeInsetLabel.swift */, DC03BEAA250BC0A60084769B /* EQNRoundedButton.swift */, DC52B8A424FCCD6900ABEBA6 /* AppTheme.swift */, + DCA5B6E6252E4BD8002AEC96 /* EQNBaseTableViewCell.swift */, + DCBB267B24D1E98300F04559 /* EQNInsetTableViewCell.swift */, ); path = UI; sourceTree = ""; @@ -732,7 +736,6 @@ children = ( DCD3E3BF24D15576007C78D4 /* PurchaseProVersionViewController.swift */, DC3BA11024D1A9C90062EE7F /* SubscriptionsViewController.swift */, - DCBB267B24D1E98300F04559 /* EQNBaseTableViewCell.swift */, DCC23DEB24D281CE003A2404 /* SubscriptionsActiveTableViewCell.swift */, DCBB267924D1E7F500F04559 /* SubscriptionsHeaderTableViewCell.swift */, DCBB267D24D1EA2000F04559 /* SubscriptionProductTableViewCell.swift */, @@ -1090,6 +1093,7 @@ DCDE0BD924E58CCE00209778 /* EQNMainTabBarController.m in Sources */, 8C4E344B2152EE5B008B0D2A /* EQNGeneratoreURLServer.m in Sources */, DC99A50724E66E5F0071BC9F /* EQNStartupCommandsBuilder.swift in Sources */, + DCA5B6E7252E4BD8002AEC96 /* EQNBaseTableViewCell.swift in Sources */, 8CF66058214C566B009F4314 /* ServerRequest.m in Sources */, 8CD08638218B3BEE0000CB5E /* ReteSismicaAnnotation.m in Sources */, DCF9E14D24F6D1AA002B6B1D /* EQNData.swift in Sources */, @@ -1098,7 +1102,7 @@ 8CF66059214C566B009F4314 /* Reachability.m in Sources */, DC886A5D24E92D5500F7A5D3 /* EQNBaseViewController.m in Sources */, 8C593E8A217BA2470008B260 /* EQNSegnalazione.m in Sources */, - DCBB267C24D1E98300F04559 /* EQNBaseTableViewCell.swift in Sources */, + DCBB267C24D1E98300F04559 /* EQNInsetTableViewCell.swift in Sources */, 8CBD3DCA2149B9AD0070C963 /* AllerteViewController.m in Sources */, DC646F32252B698B000AA5FD /* AlertsSeismicNotificationCompactTableViewCell.swift in Sources */, DCF10DCD24D2C935009F34C3 /* EQNPurchaseAvailability.swift in Sources */, diff --git a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsNoLocationTableViewCell.swift b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsNoLocationTableViewCell.swift index 6e9ba20..22ac8be 100644 --- a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsNoLocationTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsNoLocationTableViewCell.swift @@ -9,7 +9,7 @@ import UIKit import CoreLocation -class AlertsNoLocationTableViewCell: UITableViewCell { +class AlertsNoLocationTableViewCell: EQNBaseTableViewCell { @objc var status: CLAuthorizationStatus = .notDetermined { didSet { diff --git a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsPastEartquakesTableViewCell.swift b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsPastEartquakesTableViewCell.swift index d6a2d98..aee7d3f 100644 --- a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsPastEartquakesTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsPastEartquakesTableViewCell.swift @@ -8,7 +8,7 @@ import UIKit -class AlertsPastEartquakesTableViewCell: UITableViewCell { +class AlertsPastEartquakesTableViewCell: EQNBaseTableViewCell { @objc var smartphoneNetwork: EQNReteSmartphone? { didSet { diff --git a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsPriorityServiceTableViewCell.swift b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsPriorityServiceTableViewCell.swift index d802ec3..728e75b 100644 --- a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsPriorityServiceTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsPriorityServiceTableViewCell.swift @@ -8,7 +8,7 @@ import UIKit -class AlertsPriorityServiceTableViewCell: UITableViewCell { +class AlertsPriorityServiceTableViewCell: EQNBaseTableViewCell { @objc var smartphoneNetwork: EQNReteSmartphone? { didSet { diff --git a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSeismicNotificationCompactTableViewCell.swift b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSeismicNotificationCompactTableViewCell.swift index 404cdb1..cbfcc3c 100644 --- a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSeismicNotificationCompactTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSeismicNotificationCompactTableViewCell.swift @@ -8,7 +8,8 @@ import UIKit -class AlertsSeismicNotificationCompactTableViewCell: UITableViewCell { + +class AlertsSeismicNotificationCompactTableViewCell: EQNBaseTableViewCell { typealias DefaultCompletion = () -> Void diff --git a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSeismicNotificationExpandedTableViewCell.swift b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSeismicNotificationExpandedTableViewCell.swift index b5dcfe4..6253789 100644 --- a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSeismicNotificationExpandedTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSeismicNotificationExpandedTableViewCell.swift @@ -9,7 +9,7 @@ import UIKit import MapKit -class AlertsSeismicNotificationExpandedTableViewCell: UITableViewCell, MKMapViewDelegate { +class AlertsSeismicNotificationExpandedTableViewCell: EQNBaseTableViewCell, MKMapViewDelegate { typealias DefaultCompletion = () -> Void @@ -26,7 +26,6 @@ class AlertsSeismicNotificationExpandedTableViewCell: UITableViewCell, MKMapView // MARK: - Internal - @IBOutlet weak var containerView: UIView! @IBOutlet weak var notificationTitleLabel: UILabel! @IBOutlet weak var notificationDescriptionLabel: UILabel! @IBOutlet weak var mapView: MKMapView! { diff --git a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSmartphoneNetworkTableViewCell.swift b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSmartphoneNetworkTableViewCell.swift index 5ef1c22..9200f34 100644 --- a/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSmartphoneNetworkTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/Alerts/Cells/AlertsSmartphoneNetworkTableViewCell.swift @@ -8,7 +8,7 @@ import UIKit -class AlertsSmartphoneNetworkTableViewCell: UITableViewCell { +class AlertsSmartphoneNetworkTableViewCell: EQNBaseTableViewCell { @objc var smartphoneNetwork: EQNReteSmartphone? { didSet { diff --git a/Sources/Earthquake Network/Controllers/InApp/SubscriptionProductTableViewCell.swift b/Sources/Earthquake Network/Controllers/InApp/SubscriptionProductTableViewCell.swift index 62f3c32..6a2c00d 100644 --- a/Sources/Earthquake Network/Controllers/InApp/SubscriptionProductTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/InApp/SubscriptionProductTableViewCell.swift @@ -8,7 +8,7 @@ import UIKit -class SubscriptionProductTableViewCell: EQNBaseTableViewCell { +class SubscriptionProductTableViewCell: EQNInsetTableViewCell { var product: SKProduct? { didSet { diff --git a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsActiveTableViewCell.swift b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsActiveTableViewCell.swift index c63dd3d..59e5bc1 100644 --- a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsActiveTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsActiveTableViewCell.swift @@ -8,7 +8,7 @@ import UIKit -class SubscriptionsActiveTableViewCell: EQNBaseTableViewCell { +class SubscriptionsActiveTableViewCell: EQNInsetTableViewCell { var product: SKProduct? { didSet { diff --git a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsHeaderTableViewCell.swift b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsHeaderTableViewCell.swift index fc363e4..59153c2 100644 --- a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsHeaderTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsHeaderTableViewCell.swift @@ -8,7 +8,7 @@ import UIKit -class SubscriptionsHeaderTableViewCell: EQNBaseTableViewCell { +class SubscriptionsHeaderTableViewCell: EQNInsetTableViewCell { var isLoading = false { didSet { diff --git a/Sources/Earthquake Network/Controllers/Seismic Networks/Cells/SeismicNetworkTableViewCell.swift b/Sources/Earthquake Network/Controllers/Seismic Networks/Cells/SeismicNetworkTableViewCell.swift index 61a918f..1dca207 100644 --- a/Sources/Earthquake Network/Controllers/Seismic Networks/Cells/SeismicNetworkTableViewCell.swift +++ b/Sources/Earthquake Network/Controllers/Seismic Networks/Cells/SeismicNetworkTableViewCell.swift @@ -76,7 +76,13 @@ class SeismicNetworkTableViewCell: UITableViewCell { let view = UIView(frame: .zero) view.translatesAutoresizingMaskIntoConstraints = false view.layer.cornerRadius = AppTheme.shared.borderCornerRadius - view.layer.masksToBounds = true + view.layer.masksToBounds = false + + // add shadow + view.layer.shadowColor = UIColor.black.cgColor + view.layer.shadowOpacity = 0.5 + view.layer.shadowOffset = CGSize(width: 0, height: 2) + view.layer.shadowRadius = 2 return view }() diff --git a/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard b/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard index f243310..f78a4ab 100644 --- a/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard +++ b/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard @@ -391,7 +391,7 @@ In più sostieni il progetto di ricerca il quale non riceve finanziamenti estern - + @@ -518,8 +518,11 @@ In più sostieni il progetto di ricerca il quale non riceve finanziamenti estern + + + - + @@ -642,6 +645,9 @@ In più sostieni il progetto di ricerca il quale non riceve finanziamenti estern + + + @@ -1059,7 +1065,7 @@ In più sostieni il progetto di ricerca il quale non riceve finanziamenti estern - + @@ -1842,6 +1848,7 @@ In più sostieni il progetto di ricerca il quale non riceve finanziamenti estern + @@ -2070,6 +2077,9 @@ Sisma rilevato da 10 smartphone + + + @@ -2092,37 +2102,37 @@ Sisma rilevato da 10 smartphone - + - + - + @@ -2165,6 +2175,7 @@ Sisma rilevato da 10 smartphone + @@ -2198,7 +2209,7 @@ Sisma rilevato da 10 smartphone - + @@ -2248,6 +2259,7 @@ Sisma rilevato da 10 smartphone + @@ -2328,10 +2340,11 @@ Sisma rilevato da 10 smartphone + - + @@ -2388,6 +2401,9 @@ Sisma rilevato da 10 smartphone + + + diff --git a/Sources/Earthquake Network/UI/AppTheme.swift b/Sources/Earthquake Network/UI/AppTheme.swift index 8283e75..5be3af9 100644 --- a/Sources/Earthquake Network/UI/AppTheme.swift +++ b/Sources/Earthquake Network/UI/AppTheme.swift @@ -29,5 +29,5 @@ class AppTheme: NSObject { var valueColor: UIColor = .blue var borderWidth: CGFloat = 1.0 - var borderCornerRadius: CGFloat = 8.0 + var borderCornerRadius: CGFloat = 4.0 } diff --git a/Sources/Earthquake Network/UI/EQNBaseTableViewCell.swift b/Sources/Earthquake Network/UI/EQNBaseTableViewCell.swift new file mode 100644 index 0000000..a1e0c5c --- /dev/null +++ b/Sources/Earthquake Network/UI/EQNBaseTableViewCell.swift @@ -0,0 +1,33 @@ +// +// EQNBaseTableViewCell.swift +// Earthquake Network +// +// Created by Busi Andrea on 07/10/2020. +// Copyright © 2020 Earthquake Network. All rights reserved. +// + +import Foundation + + +class EQNBaseTableViewCell: UITableViewCell { + + @IBOutlet weak var containerView: UIView! + + // MARK: - View Lifecycle + + override func awakeFromNib() { + super.awakeFromNib() + + clipsToBounds = true + + // rounded corners + containerView.layer.cornerRadius = AppTheme.shared.borderCornerRadius + containerView.layer.masksToBounds = false + + // apply a shadow to the container view + containerView.layer.shadowColor = UIColor.black.cgColor + containerView.layer.shadowOpacity = 0.5 + containerView.layer.shadowOffset = CGSize(width: 0, height: 2) + containerView.layer.shadowRadius = 2 + } +} diff --git a/Sources/Earthquake Network/Controllers/InApp/EQNBaseTableViewCell.swift b/Sources/Earthquake Network/UI/EQNInsetTableViewCell.swift similarity index 85% rename from Sources/Earthquake Network/Controllers/InApp/EQNBaseTableViewCell.swift rename to Sources/Earthquake Network/UI/EQNInsetTableViewCell.swift index 39b3be9..0be2671 100644 --- a/Sources/Earthquake Network/Controllers/InApp/EQNBaseTableViewCell.swift +++ b/Sources/Earthquake Network/UI/EQNInsetTableViewCell.swift @@ -1,5 +1,5 @@ // -// EQNBaseTableViewCell.swift +// EQNInsetTableViewCell.swift // Earthquake Network // // Created by Busi Andrea on 29/07/2020. @@ -9,7 +9,7 @@ import Foundation -class EQNBaseTableViewCell: UITableViewCell { +class EQNInsetTableViewCell: UITableViewCell { override var frame: CGRect { get { return super.frame