123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- //
- // ActionSheetAppearance.swift
- // Sheeeeeeeeet
- //
- // Created by Daniel Saidi on 2017-11-18.
- // Copyright © 2017 Daniel Saidi. All rights reserved.
- //
- /*
-
- This class is used to specify the appearance for all action
- sheets and action sheet items provided by Sheeeeeeeeet. Use
- `ActionSheetAppearance.standard` to style all action sheets
- in an entire app. You can then apply individual appearances
- to individual action sheets and item types.
-
- The `item` appearance property is used as the base template
- for all other item appearances.
-
- */
- import UIKit
- open class ActionSheetAppearance {
-
-
- // MARK: - Initialization
-
- public init() {}
-
- public init(copy: ActionSheetAppearance) {
- cornerRadius = copy.cornerRadius
- contentInset = copy.contentInset
- groupMargins = copy.groupMargins
-
- separatorColor = copy.separatorColor
- itemsSeparatorColor = copy.itemsSeparatorColor ?? separatorColor
- buttonsSeparatorColor = copy.buttonsSeparatorColor ?? separatorColor
-
- item = ActionSheetItemAppearance(copy: copy.item)
- popover = ActionSheetPopoverAppearance(copy: copy.popover)
-
- cancelButton = ActionSheetCancelButtonAppearance(copy: copy.cancelButton)
- dangerButton = ActionSheetDangerButtonAppearance(copy: copy.dangerButton)
- okButton = ActionSheetOkButtonAppearance(copy: copy.okButton)
-
- collectionItem = ActionSheetCollectionItemAppearance(copy: copy.collectionItem)
- customItem = ActionSheetCustomItemAppearance(copy: copy.customItem)
- linkItem = ActionSheetLinkItemAppearance(copy: copy.linkItem)
- multiSelectItem = ActionSheetMultiSelectItemAppearance(copy: copy.multiSelectItem)
- multiSelectToggleItem = ActionSheetMultiSelectToggleItemAppearance(copy: copy.multiSelectToggleItem)
- selectItem = ActionSheetSelectItemAppearance(copy: copy.selectItem)
- singleSelectItem = ActionSheetSingleSelectItemAppearance(copy: copy.singleSelectItem)
-
- sectionMargin = ActionSheetSectionMarginAppearance(copy: copy.sectionMargin)
- sectionTitle = ActionSheetSectionTitleAppearance(copy: copy.sectionTitle)
- title = ActionSheetTitleAppearance(copy: copy.title)
- }
-
-
- // MARK: - Properties
-
- public var cornerRadius: CGFloat = 10
- public var contentInset: CGFloat = 15
- public var groupMargins: CGFloat = 15
-
- public var separatorColor: UIColor?
- public var itemsSeparatorColor: UIColor?
- public var buttonsSeparatorColor: UIColor?
-
-
- // MARK: - Appearance Properties
-
- public static var standard = ActionSheetAppearance()
-
- public lazy var item: ActionSheetItemAppearance = {
- return ActionSheetItemAppearance()
- }()
-
- public lazy var popover: ActionSheetPopoverAppearance = {
- return ActionSheetPopoverAppearance(width: 300)
- }()
-
-
- // MARK: - Buttons
-
- public lazy var cancelButton: ActionSheetCancelButtonAppearance = {
- return ActionSheetCancelButtonAppearance(copy: item)
- }()
-
- public lazy var dangerButton: ActionSheetDangerButtonAppearance = {
- return ActionSheetDangerButtonAppearance(copy: item)
- }()
-
- public lazy var okButton: ActionSheetOkButtonAppearance = {
- return ActionSheetOkButtonAppearance(copy: item)
- }()
-
-
- // MARK: - Items
-
- public lazy var collectionItem: ActionSheetCollectionItemAppearance = {
- return ActionSheetCollectionItemAppearance(copy: item)
- }()
-
- public lazy var customItem: ActionSheetCustomItemAppearance = {
- return ActionSheetCustomItemAppearance(copy: item)
- }()
-
- public lazy var linkItem: ActionSheetLinkItemAppearance = {
- return ActionSheetLinkItemAppearance(copy: item)
- }()
-
- public lazy var multiSelectItem: ActionSheetMultiSelectItemAppearance = {
- return ActionSheetMultiSelectItemAppearance(copy: selectItem)
- }()
-
- public lazy var multiSelectToggleItem: ActionSheetMultiSelectToggleItemAppearance = {
- return ActionSheetMultiSelectToggleItemAppearance(copy: item)
- }()
-
- public lazy var selectItem: ActionSheetSelectItemAppearance = {
- return ActionSheetSelectItemAppearance(copy: item)
- }()
-
- public lazy var singleSelectItem: ActionSheetSingleSelectItemAppearance = {
- return ActionSheetSingleSelectItemAppearance(copy: selectItem)
- }()
-
-
- // MARK: - Titles
-
- public lazy var sectionMargin: ActionSheetSectionMarginAppearance = {
- return ActionSheetSectionMarginAppearance(copy: item)
- }()
-
- public lazy var sectionTitle: ActionSheetSectionTitleAppearance = {
- return ActionSheetSectionTitleAppearance(copy: item)
- }()
-
- public lazy var title: ActionSheetTitleAppearance = {
- return ActionSheetTitleAppearance(copy: item)
- }()
- }
|