From a71ee9afbf8a06ffe78646f2dce1356f4ad20eeb Mon Sep 17 00:00:00 2001 From: Andrea Busi Date: Fri, 11 Sep 2020 17:01:12 +0200 Subject: [PATCH] feat: Add class to style rounded buttons --- .../project.pbxproj | 4 +++ .../UI/EQNRoundedButton.swift | 36 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Sources/Earthquake Network/UI/EQNRoundedButton.swift diff --git a/Sources/Earthquake Network.xcodeproj/project.pbxproj b/Sources/Earthquake Network.xcodeproj/project.pbxproj index 170f41e..ff5454c 100644 --- a/Sources/Earthquake Network.xcodeproj/project.pbxproj +++ b/Sources/Earthquake Network.xcodeproj/project.pbxproj @@ -101,6 +101,7 @@ 8CF66059214C566B009F4314 /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CF66056214C566A009F4314 /* Reachability.m */; }; 8CFA6323219A2C610099EB0E /* Tsunami.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CFA6322219A2C610099EB0E /* Tsunami.m */; }; C89115902FEA7A0A31514912 /* Pods_Earthquake_Network.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25A8BFFE29D46740E8A8A7A3 /* Pods_Earthquake_Network.framework */; }; + DC03BEAB250BC0A60084769B /* EQNRoundedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC03BEAA250BC0A60084769B /* EQNRoundedButton.swift */; }; DC08803F24F5A89000186D97 /* SettingEnableTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC08803E24F5A89000186D97 /* SettingEnableTableViewCell.swift */; }; DC08804124F5B41400186D97 /* SettingSliderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC08804024F5B41400186D97 /* SettingSliderTableViewCell.swift */; }; DC0E551324F8063300D54270 /* SettingSegmentedTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC0E551224F8063300D54270 /* SettingSegmentedTableViewCell.swift */; }; @@ -317,6 +318,7 @@ 8CFA6321219A2C610099EB0E /* Tsunami.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Tsunami.h; sourceTree = ""; }; 8CFA6322219A2C610099EB0E /* Tsunami.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Tsunami.m; sourceTree = ""; }; C4FB0D7EEA34F8222369E1BB /* Pods-Earthquake Network.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Earthquake Network.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Earthquake Network/Pods-Earthquake Network.debug.xcconfig"; sourceTree = ""; }; + DC03BEAA250BC0A60084769B /* EQNRoundedButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EQNRoundedButton.swift; sourceTree = ""; }; DC08803E24F5A89000186D97 /* SettingEnableTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingEnableTableViewCell.swift; sourceTree = ""; }; DC08804024F5B41400186D97 /* SettingSliderTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingSliderTableViewCell.swift; sourceTree = ""; }; DC0E551224F8063300D54270 /* SettingSegmentedTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingSegmentedTableViewCell.swift; sourceTree = ""; }; @@ -732,6 +734,7 @@ isa = PBXGroup; children = ( DCC23DEE24D28F58003A2404 /* EQNEdgeInsetLabel.swift */, + DC03BEAA250BC0A60084769B /* EQNRoundedButton.swift */, DC52B8A424FCCD6900ABEBA6 /* AppTheme.swift */, ); path = UI; @@ -1081,6 +1084,7 @@ DCBB267E24D1EA2000F04559 /* SubscriptionProductTableViewCell.swift in Sources */, 8CFA6323219A2C610099EB0E /* Tsunami.m in Sources */, DC99A50524E66E430071BC9F /* EQNAppearanceCommand.swift in Sources */, + DC03BEAB250BC0A60084769B /* EQNRoundedButton.swift in Sources */, 8CCE164E21E7BACE00173CD9 /* EQNNotificheSegnalazioniUtente.m in Sources */, DCD4571C24F6CF0D00B58304 /* EQNGenericValue.swift in Sources */, 8C4E343F215012FA008B0D2A /* EQNManager.m in Sources */, diff --git a/Sources/Earthquake Network/UI/EQNRoundedButton.swift b/Sources/Earthquake Network/UI/EQNRoundedButton.swift new file mode 100644 index 0000000..9b9d30d --- /dev/null +++ b/Sources/Earthquake Network/UI/EQNRoundedButton.swift @@ -0,0 +1,36 @@ +// +// EQNRoundedButton.swift +// Earthquake Network +// +// Created by Busi Andrea on 11/09/2020. +// Copyright © 2020 Earthquake Network. All rights reserved. +// + +import UIKit + +class EQNRoundedButton: UIButton { + + // MARK: - Init + + override init(frame: CGRect) { + super.init(frame: frame) + setupUI() + } + + required init?(coder: NSCoder) { + super.init(coder: coder) + setupUI() + } + + // MARK: - Private + + private func setupUI() { + backgroundColor = .white + layer.masksToBounds = true + layer.borderWidth = AppTheme.shared.borderWidth + layer.borderColor = AppTheme.Colors.darkGray.cgColor + layer.cornerRadius = AppTheme.shared.borderCornerRadius + + setTitle(titleLabel?.text?.uppercased(), for: .normal) + } +}