Merge pull request #273 from SimplyDanny/remove-overrides

Remove unneeded overrides in custom views
This commit is contained in:
Yishi Lin 2019-06-15 15:27:58 +08:00 committed by GitHub
commit 4964126c4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 33 additions and 70 deletions

View file

@ -127,7 +127,7 @@
DCFB77A31E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCFB77A21E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib */; };
DCFB77A71E502DF9008DE471 /* EditPasswordTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77A61E502DF9008DE471 /* EditPasswordTableViewController.swift */; };
DCFB77A91E502FF6008DE471 /* PasswordEditorTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */; };
DCFB77AB1E503729008DE471 /* ContentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77AA1E503729008DE471 /* ContentTableViewCell.swift */; };
DCFB77AB1E503729008DE471 /* ContentProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77AA1E503729008DE471 /* ContentProvider.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -327,7 +327,7 @@
DCFB77A21E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PasswordDetailTitleTableViewCell.xib; sourceTree = "<group>"; };
DCFB77A61E502DF9008DE471 /* EditPasswordTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditPasswordTableViewController.swift; sourceTree = "<group>"; };
DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordEditorTableViewController.swift; sourceTree = "<group>"; };
DCFB77AA1E503729008DE471 /* ContentTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentTableViewCell.swift; sourceTree = "<group>"; };
DCFB77AA1E503729008DE471 /* ContentProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentProvider.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -628,7 +628,7 @@
DC19400F1E4B3A9E0077E0A3 /* Views */ = {
isa = PBXGroup;
children = (
DCFB77AA1E503729008DE471 /* ContentTableViewCell.swift */,
DCFB77AA1E503729008DE471 /* ContentProvider.swift */,
DCFB779C1E4F40C7008DE471 /* FillPasswordTableViewCell.swift */,
DCFB779D1E4F40C7008DE471 /* FillPasswordTableViewCell.xib */,
DC4914941E434301007FF592 /* LabelTableViewCell.swift */,
@ -1115,7 +1115,7 @@
A2A61C201EEFABAD00CFE063 /* UtilsExtension.swift in Sources */,
DC8963C01E38EEB900828B09 /* SSHKeySettingTableViewController.swift in Sources */,
DC193FFA1E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift in Sources */,
DCFB77AB1E503729008DE471 /* ContentTableViewCell.swift in Sources */,
DCFB77AB1E503729008DE471 /* ContentProvider.swift in Sources */,
DCA0499C1E3362F400522E8F /* PGPKeySettingTableViewController.swift in Sources */,
DC4914961E434301007FF592 /* LabelTableViewCell.swift in Sources */,
DC5F385B1E56AADB00C69ACA /* PGPKeyArmorSettingTableViewController.swift in Sources */,

View file

@ -0,0 +1,12 @@
//
// ContentTableViewCell.swift
// pass
//
// Created by Mingshen Sun on 12/2/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
//
protocol ContentProvider {
func getContent() -> String?
func setContent(content: String?)
}

View file

@ -1,28 +0,0 @@
//
// ContentTableViewCell.swift
// pass
//
// Created by Mingshen Sun on 12/2/2017.
// Copyright © 2017 Bob Sun. All rights reserved.
//
import UIKit
class ContentTableViewCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
func getContent() -> String? {
return nil
}
func setContent(content: String?) { }
}

View file

@ -14,7 +14,7 @@ protocol FillPasswordTableViewCellDelegate {
func showHidePasswordSettings()
}
class FillPasswordTableViewCell: ContentTableViewCell {
class FillPasswordTableViewCell: UITableViewCell, ContentProvider {
@IBOutlet weak var contentTextField: UITextField!
var delegate: FillPasswordTableViewCellDelegate?
@ -32,12 +32,6 @@ class FillPasswordTableViewCell: ContentTableViewCell {
generateButton.imageView?.contentMode = .scaleAspectFit
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
@IBAction func generatePassword(_ sender: UIButton) {
self.delegate?.generateAndCopyPassword()
}
@ -51,11 +45,11 @@ class FillPasswordTableViewCell: ContentTableViewCell {
contentTextField.attributedText = Utils.attributedPassword(plainPassword: sender.text ?? "")
}
override func getContent() -> String? {
func getContent() -> String? {
return contentTextField.attributedText?.string
}
override func setContent(content: String?) {
func setContent(content: String?) {
contentTextField.attributedText = Utils.attributedPassword(plainPassword: content ?? "")
}
}

View file

@ -13,7 +13,7 @@ protocol PasswordSettingSliderTableViewCellDelegate {
func generateAndCopyPassword()
}
class SliderTableViewCell: ContentTableViewCell {
class SliderTableViewCell: UITableViewCell, ContentProvider {
@IBOutlet weak var titleLabel: UILabel!
@IBOutlet weak var valueLabel: UILabel!
@ -27,17 +27,6 @@ class SliderTableViewCell: ContentTableViewCell {
}
}
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
@IBAction func handleSliderValueChange(_ sender: UISlider) {
let oldRoundedValue = self.roundedValue
let newRoundedValue = Int(sender.value)
@ -67,4 +56,9 @@ class SliderTableViewCell: ContentTableViewCell {
}
}
func getContent() -> String? {
return nil
}
func setContent(content: String?) {}
}

View file

@ -8,22 +8,15 @@
import UIKit
class TextFieldTableViewCell: ContentTableViewCell {
class TextFieldTableViewCell: UITableViewCell, ContentProvider {
@IBOutlet weak var contentTextField: UITextField!
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
override func getContent() -> String? {
func getContent() -> String? {
return contentTextField.text
}
override func setContent(content: String?) {
func setContent(content: String?) {
contentTextField.text = content
}
}

View file

@ -8,23 +8,21 @@
import UIKit
class TextViewTableViewCell: ContentTableViewCell {
class TextViewTableViewCell: UITableViewCell, ContentProvider {
@IBOutlet weak var contentTextView: UITextView!
override func awakeFromNib() {
super.awakeFromNib()
self.contentTextView.textContainer.lineFragmentPadding = 0
self.contentTextView.textContainerInset = .zero
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
override func getContent() -> String? {
func getContent() -> String? {
return contentTextView.text
}
override func setContent(content: String?) {
func setContent(content: String?) {
contentTextView.text = content
}
}