Update podspec only Source
This commit is contained in:
-273
@@ -1,273 +0,0 @@
|
||||
//
|
||||
// ExamplesContainerController.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by mrustaa on 31/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
|
||||
class ExamplesContainerController: ContainerController, ExampleCellDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var items: [TableAdapterItem] = []
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(addTo controller: UIViewController, style: ExamplesContainerController.ScrollType) {
|
||||
|
||||
let layout = ContainerLayout()
|
||||
layout.startPosition = .hide
|
||||
layout.backgroundShadowShow = false
|
||||
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
|
||||
|
||||
super.init(addTo: controller, layout: layout)
|
||||
|
||||
loadContainerView()
|
||||
loadTableItems()
|
||||
|
||||
var scrollIndex: CGFloat = 0
|
||||
switch style {
|
||||
case .tableAdapterView: scrollIndex = 1
|
||||
case .collectionAdapterView: scrollIndex = 2
|
||||
case .collectionAdapterView2: scrollIndex = 3
|
||||
case .textView: scrollIndex = 4
|
||||
default: break
|
||||
}
|
||||
|
||||
exampleCell( TableAdapterCell(), type: .scroll, value: scrollIndex, endEditing: true)
|
||||
}
|
||||
|
||||
//MARK: - Load Container-View
|
||||
|
||||
func loadContainerView() {
|
||||
|
||||
view.backgroundColor = .white
|
||||
view.cornerRadius = 15
|
||||
view.addShadow()
|
||||
}
|
||||
|
||||
//MARK: - Load Items
|
||||
|
||||
func loadTableItems() {
|
||||
|
||||
items = []
|
||||
|
||||
let h: CGFloat = 45
|
||||
|
||||
items = [
|
||||
ExampleSegmentCellItem(height: h, delegate: self, type: .moveType, segmentItems: ["Top", "Middle", "Bottom", "Hide"]),
|
||||
ExampleSegmentCellItem(height: h, delegate: self, type: .headerView, segmentItems: ["-", "Grip", "Label", "Details", "Search"]),
|
||||
ExampleSegmentCellItem(height: h, delegate: self, type: .footerView, segmentItems: ["-", "Button", "TabBar"]),
|
||||
ExampleSegmentCellItem(height: h, delegate: self, type: .color, segmentItems: ["-", ".white", ".red", ".green", ".blue"], index: 1),
|
||||
ExampleSegmentCellItem(height: h, delegate: self, type: .blur, segmentItems: ["-", "Light", "ExtraLight", "Dark"]),
|
||||
ExampleSegmentCellItem(height: h, delegate: self, type: .scroll, segmentItems: ["-", "Table", "Coll", "Coll2", "Text"]),
|
||||
|
||||
ExampleSwitchCellItem(height: h, delegate: self, type: .shadowBackground, value: false),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .shadowContainer, value: 0.2, maximumValue: 1.0),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .cornerRadius, value: 15, maximumValue: 140),
|
||||
ExampleSwitchCellItem(height: h, delegate: self, type: .movingEnabled, value: true),
|
||||
ExampleSwitchCellItem(height: h, delegate: self, type: .trackingPosition, value: false),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .footerPadding, value: 0, maximumValue: Float(ContainerDevice.screenMax)),
|
||||
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .top, value: 70, maximumValue: 250),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .middle, value: 250, maximumValue: 500, minimumValue: 140),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .bottom, value: 70, maximumValue: 300),
|
||||
ExampleSwitchCellItem(height: h, delegate: self, type: .middleEnable, value: true),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .insetsLeft, value: 0, maximumValue: Float(ContainerDevice.screenMin)),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .insetsRight, value: 0, maximumValue: Float(ContainerDevice.screenMin)),
|
||||
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .landscapeTop, value: 20, maximumValue: 250),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .landscapeMiddle, value: 150, maximumValue: 300, minimumValue: 70),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .landscapeBottom, value: 70, maximumValue: 300),
|
||||
ExampleSwitchCellItem(height: h, delegate: self, type: .landscapeMiddleEnable, value: false),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .landscapeInsetsLeft, value: 0, maximumValue: Float(ContainerDevice.screenMax)),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .landscapeInsetsRight, value: 0, maximumValue: Float(ContainerDevice.screenMax)),
|
||||
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .scrollIndicatorInsetsTop, value: 0, maximumValue: 300),
|
||||
ExampleSliderCellItem(height: h, delegate: self, type: .scrollIndicatorInsetsBottom, value: 0, maximumValue: 300),
|
||||
|
||||
]
|
||||
}
|
||||
|
||||
// MARK: - Cell Delegate
|
||||
|
||||
func exampleCell(_ cell: TableAdapterCell, type: ExampleCell.Style, value: CGFloat, endEditing: Bool) {
|
||||
|
||||
// print("\(type) \(value) ")
|
||||
let boolValue = (value == 1)
|
||||
|
||||
switch type {
|
||||
case .top
|
||||
, .middle
|
||||
, .bottom
|
||||
, .landscapeTop
|
||||
, .landscapeMiddle
|
||||
, .landscapeBottom
|
||||
, .insetsLeft
|
||||
, .insetsRight
|
||||
, .landscapeInsetsLeft
|
||||
, .landscapeInsetsRight:
|
||||
if !endEditing { return }
|
||||
default: break
|
||||
}
|
||||
|
||||
switch type {
|
||||
|
||||
case .cornerRadius: self.view.cornerRadius = value
|
||||
|
||||
case .shadowContainer: self.view.addShadow(opacity: value)
|
||||
|
||||
case .movingEnabled: set(movingEnabled: boolValue)
|
||||
|
||||
case .trackingPosition: set(trackingPosition: boolValue)
|
||||
|
||||
case .footerPadding: set(footerPadding: value)
|
||||
|
||||
// MARK: ScrollInsets
|
||||
|
||||
case .scrollIndicatorInsetsTop: set(scrollIndicatorTop: value)
|
||||
case .scrollIndicatorInsetsBottom: set(scrollIndicatorBottom: value)
|
||||
|
||||
// MARK: Positions
|
||||
|
||||
case .top: set(top: value); if ContainerDevice.isPortrait { move(type: .top) }
|
||||
case .middle: set(middle: value); if ContainerDevice.isPortrait { move(type: .middle) }
|
||||
case .bottom: set(bottom: value); if ContainerDevice.isPortrait { move(type: .bottom) }
|
||||
|
||||
case .landscapeTop: setLandscape(top: value); if !ContainerDevice.isPortrait { move(type: .top) }
|
||||
case .landscapeMiddle: setLandscape(middle: value); if !ContainerDevice.isPortrait { move(type: .middle) }
|
||||
case .landscapeBottom: setLandscape(bottom: value); if !ContainerDevice.isPortrait { move(type: .bottom) }
|
||||
|
||||
// MARK: MiddleEnable
|
||||
|
||||
case .middleEnable: set(middle: (boolValue ? 250 : nil))
|
||||
|
||||
case .landscapeMiddleEnable: setLandscape(middle: (boolValue ? 150 : nil))
|
||||
|
||||
|
||||
// MARK: Background Shadow
|
||||
|
||||
case .shadowBackground: set(backgroundShadowShow: boolValue)
|
||||
|
||||
case .landscapeShadowBackground: setLandscape(backgroundShadowShow: boolValue)
|
||||
|
||||
// MARK: Insets
|
||||
|
||||
case .insetsLeft: set(left: value)
|
||||
case .insetsRight: set(right: value)
|
||||
|
||||
case .landscapeInsetsLeft: setLandscape(left: value)
|
||||
case .landscapeInsetsRight: setLandscape(right: value)
|
||||
|
||||
// MARK: MoveType
|
||||
|
||||
case .moveType:
|
||||
|
||||
switch value {
|
||||
case 0: move(type: .top)
|
||||
case 1: move(type: .middle)
|
||||
case 2: move(type: .bottom)
|
||||
default: move(type: .hide)
|
||||
}
|
||||
|
||||
// MARK: ScrollViews
|
||||
|
||||
case .scroll:
|
||||
|
||||
switch value {
|
||||
case 1: add(scrollView: createTableAdapterView(items: items, view: view))
|
||||
case 2: add(scrollView: createMapsCollectionAdapterView())
|
||||
case 3: add(scrollView: createCollectionAdapterView(width: view.width))
|
||||
case 4: add(scrollView: createTextView())
|
||||
default: removeScrollView()
|
||||
}
|
||||
|
||||
|
||||
// MARK: HeaderView
|
||||
|
||||
case .headerView:
|
||||
switch value {
|
||||
case 1:
|
||||
let header = ExampleHeaderGripView()
|
||||
header.height = 20
|
||||
self.add(headerView: header)
|
||||
case 2:
|
||||
let header = MapsMenuHeader()
|
||||
header.titleLabel.text = "Settings"
|
||||
header.separatorView?.alpha = 1.0
|
||||
self.add(headerView: header)
|
||||
case 3:
|
||||
let header = HeaderDetailsView()
|
||||
header.titleLabel.text = "Title Header"
|
||||
header.subtitle.text = "Subtitle"
|
||||
header.textButton.setTitle("Button Text", for: .normal)
|
||||
header.separatorView?.alpha = 1.0
|
||||
self.add(headerView: header)
|
||||
case 4:
|
||||
let header = HeaderSearchBarView()
|
||||
header.separatorView?.alpha = 1.0
|
||||
self.add(headerView: header)
|
||||
default:
|
||||
self.removeHeaderView()
|
||||
}
|
||||
|
||||
// MARK: FooterView
|
||||
|
||||
case .footerView:
|
||||
switch value {
|
||||
case 1:
|
||||
let footer = ExampleFooterButtonView()
|
||||
self.add(footerView: footer)
|
||||
case 2:
|
||||
let tabbar = HeaderTabBarView()
|
||||
tabbar.height = (49.0 + ContainerDevice.isIphoneXBottom)
|
||||
self.add(footerView: tabbar)
|
||||
default:
|
||||
self.removeFooterView()
|
||||
}
|
||||
|
||||
// MARK: BackgroundColor
|
||||
|
||||
case .color:
|
||||
self.view.removeBlur()
|
||||
|
||||
switch value {
|
||||
case 0: view.backgroundColor = .clear
|
||||
case 1: view.backgroundColor = .white
|
||||
case 2: view.backgroundColor = .systemRed
|
||||
case 3: view.backgroundColor = .systemGreen
|
||||
case 4: view.backgroundColor = .systemBlue
|
||||
default: break
|
||||
}
|
||||
|
||||
|
||||
// MARK: Blur
|
||||
|
||||
case .blur:
|
||||
view.backgroundColor = .clear
|
||||
|
||||
switch value {
|
||||
case 0: self.view.removeBlur()
|
||||
case 1: self.view.addBlur(style: .light)
|
||||
case 2: self.view.addBlur(style: .extraLight)
|
||||
case 3: self.view.addBlur(style: .dark)
|
||||
default: break
|
||||
}
|
||||
|
||||
default: break
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
//
|
||||
// ExamplesContainerControllerScrollType.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by mrustaa on 03/06/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension ExamplesContainerController {
|
||||
|
||||
public enum ScrollType: String, CaseIterable {
|
||||
case empty = "-"
|
||||
case tableAdapterView = "TableAdapterView (⚙️ Settings)"
|
||||
case collectionAdapterView = "CollectionAdapterView"
|
||||
case collectionAdapterView2 = "CollectionAdapterView 2"
|
||||
case textView = "TextView"
|
||||
case mapsContainer = "Main (Maps.app)"
|
||||
case locationContainer = "Location (Maps.app)"
|
||||
case routeContainer = "Route (Maps.app)"
|
||||
case menuContainer = "Menu (Maps.app)"
|
||||
}
|
||||
}
|
||||
|
||||
-138
@@ -1,138 +0,0 @@
|
||||
//
|
||||
// ExamplesScrollViews.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by mrustaa on 30/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - CollectionAdapterView Maps
|
||||
|
||||
func createMapsCollectionAdapterView() -> CollectionAdapterView {
|
||||
|
||||
let colletion = CollectionAdapterView(frame: CGRect.zero, collectionViewLayout: UICollectionViewFlowLayout())
|
||||
var colletionItems: [CollectionAdapterItem] = []
|
||||
|
||||
for _ in 0...3 {
|
||||
for item in MapsFavoritesCellData.collectionItems() {
|
||||
colletionItems.append(item)
|
||||
}
|
||||
}
|
||||
|
||||
colletion.set(items: colletionItems)
|
||||
|
||||
return colletion
|
||||
}
|
||||
|
||||
// MARK: - CollectionAdapterView
|
||||
|
||||
func createCollectionAdapterView(width: CGFloat) -> CollectionAdapterView {
|
||||
|
||||
let layout = UICollectionViewFlowLayout()
|
||||
|
||||
let padding: CGFloat = 15
|
||||
layout.sectionInset = UIEdgeInsets(top: padding, left: padding, bottom: padding, right: padding)
|
||||
layout.minimumLineSpacing = padding
|
||||
layout.minimumInteritemSpacing = padding
|
||||
|
||||
let colletion = CollectionAdapterView(frame: CGRect.zero, collectionViewLayout: layout)
|
||||
|
||||
var colletionItems: [CollectionAdapterItem] = []
|
||||
for _ in 1...17 {
|
||||
colletionItems.append( ExampleCollectionItem(width: width - 1, padding: padding) )
|
||||
}
|
||||
colletion.set(items: colletionItems)
|
||||
|
||||
return colletion
|
||||
}
|
||||
|
||||
// MARK: - TableAdapterView
|
||||
|
||||
func createTableAdapterView(items: [TableAdapterItem]? = nil, view: UIView) -> TableAdapterView {
|
||||
|
||||
let table = TableAdapterView()
|
||||
table.separatorColor = Colors.grayLevel(0.75)
|
||||
|
||||
if let items = items {
|
||||
table.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
table.didScrollCallback = {
|
||||
view.endEditing(true)
|
||||
}
|
||||
return table
|
||||
}
|
||||
|
||||
// MARK: - TableView
|
||||
|
||||
func createTableView() -> UITableView {
|
||||
|
||||
let tableView = UITableView()
|
||||
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
|
||||
tableView.backgroundColor = .clear
|
||||
tableView.tableFooterView = UIView()
|
||||
|
||||
return tableView
|
||||
|
||||
}
|
||||
|
||||
// MARK: - TextView
|
||||
|
||||
func createTextView() -> UITextView {
|
||||
|
||||
let textView = UITextView()
|
||||
textView.returnKeyType = .done
|
||||
textView.backgroundColor = .clear
|
||||
textView.font = UIFont.systemFont(ofSize: 15)
|
||||
textView.text = """
|
||||
This example demonstrates a block quote. Because some introductory phrases will lead
|
||||
naturally into the block quote,
|
||||
you might choose to begin the block quote with a lowercase letter. In this and the later
|
||||
examples we use “Lorem ipsum” text to ensure that each block quotation contains 40 words or
|
||||
more. Lorem ipsum dolor sit amet, consectetur adipiscing elit. (Organa, 2013, p. 234)
|
||||
Example 2
|
||||
This example also demonstrates a block quote. Some introductory sentences end abruptly in a
|
||||
colon or a period:
|
||||
In those cases, you are more likely to capitalize the beginning word of the block quotation.
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed nisi mi, pharetra sit amet mi vitae,
|
||||
commodo accumsan dui. Donec non scelerisque quam. Pellentesque ut est sed neque.
|
||||
(Calrissian, 2013, para. 3)
|
||||
Example 3
|
||||
This is another example of a block quotation. Sometimes, the author(s) being cited will be
|
||||
included in the introduction. In that case, according to Skywalker and Solo,
|
||||
because the author names are in the introduction of this quote, the parentheses that follow it
|
||||
will include only the year and the page number. Lorem ipsum dolor sit amet, consectetur
|
||||
adipiscing elit. Sed nisi mi, pharetra sit amet mi vitae, commodo accumsan dui. Donec non
|
||||
scelerisque quam. Pellentesque ut est sed neque. (2013, p. 103)
|
||||
Copyright © 2013 by the American Psychological Association. This content may be reproduced for classroom or teaching purposes
|
||||
provided that credit is given to the American Psychological Association. For any other use, please contact the APA Permissions Office.
|
||||
Example 4
|
||||
In this example, we have added our own emphasis. This needs to be indicated parenthetically,
|
||||
so the reader knows that the italics were not in the original text. Amidala (2009) dabbled in hyperbole,
|
||||
saying,
|
||||
Random Explosions 2: Revenge of the Dialogue is the worst movie in the history of time
|
||||
[emphasis added]. . . . it’s [sic] promise of dialogue is a misnomer of explosive proportions. Lorem ipsum
|
||||
dolor sit amet, consectetur adipiscing elit. Sed nisi mi, pharetra sit amet mi vitae. (p. 13)
|
||||
This paragraph appears flush left because it is a continuation of the paragraph we began above the block
|
||||
quote. Note that we also added “[sic]” within the block quotation to indicate that a misspelling was in
|
||||
the original text, and we’ve included ellipses (with four periods) because we have omitted a sentence
|
||||
from the quotation (see pp. 172–173 of the Publication Manual of the American Psychological
|
||||
Association).
|
||||
Example 5
|
||||
This example is similar to the previous one, except that we have continued the quotation to
|
||||
include text from a second paragraph. Amidala (2009) dabbled in hyperbole, saying,
|
||||
Random Explosions 2: Revenge of the Dialogue is the worst movie in the history of time
|
||||
[emphasis added]. . . . it’s [sic] promise of dialogue is a misnomer of explosive proportions.
|
||||
On the other hand, Delightful Banter on Windswept Mountainside is a film to be
|
||||
cherished for all time. Filmmakers hoping to top this film should abandon hope. (p. 13)
|
||||
This paragraph begins with an indent because we do not intend it to continue the paragraph
|
||||
that we started above the block quote. Note that we also added “[sic]” within the block quotation to
|
||||
indicate that a misspelling was in the original text, and we’ve included ellipses (with four periods)
|
||||
because we have omitted a sentence from this quotation (see pp. 172–173 of the Manual).
|
||||
"""
|
||||
|
||||
return textView
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Examples Settings View Controller-->
|
||||
<scene sceneID="0f9-5i-ygC">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="ExamplesSettingsViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="p3c-kf-PfN" customClass="ExamplesSettingsViewController" customModule="ContainerControllerSwift_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="jmi-Lo-St4">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="O8q-9T-eRg" customClass="TableAdapterView" customModule="ContainerControllerSwift">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.88235294117647056" green="0.88235294117647056" blue="0.90588235294117647" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="O8q-9T-eRg" firstAttribute="leading" secondItem="QCP-uk-H24" secondAttribute="leading" id="46G-CM-8RI"/>
|
||||
<constraint firstItem="O8q-9T-eRg" firstAttribute="top" secondItem="QCP-uk-H24" secondAttribute="top" id="Atq-wk-zuf"/>
|
||||
<constraint firstItem="O8q-9T-eRg" firstAttribute="trailing" secondItem="QCP-uk-H24" secondAttribute="trailing" id="DUT-hr-P4d"/>
|
||||
<constraint firstItem="O8q-9T-eRg" firstAttribute="bottom" secondItem="QCP-uk-H24" secondAttribute="bottom" id="HrH-NQ-v3t"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="QCP-uk-H24"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="tableView" destination="O8q-9T-eRg" id="DQQ-1i-fpA"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Uzt-sR-4xA" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="781.60000000000002" y="43.628185907046479"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
-124
@@ -1,124 +0,0 @@
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
|
||||
class ExamplesSettingsViewController: StoryboardController {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var containers: [ContainerController] = []
|
||||
var items: [TableAdapterItem] = []
|
||||
|
||||
@IBOutlet weak var tableView: TableAdapterView?
|
||||
|
||||
// MARK: - Life cycle
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
let barButtonAddItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(navigationBarAddAction))
|
||||
let barButtonCloseItem = UIBarButtonItem(barButtonSystemItem: .close, target: self, action: #selector(navigationBarCloseAction))
|
||||
self.navigationItem.rightBarButtonItems = [ barButtonAddItem, barButtonCloseItem ]
|
||||
|
||||
loadTableView()
|
||||
|
||||
containers(addStyle: .tableAdapterView)
|
||||
}
|
||||
|
||||
override func viewDidDisappear(_ animated: Bool) {
|
||||
super.viewDidDisappear(animated)
|
||||
|
||||
for container in containers {
|
||||
container.remove()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Load TableView
|
||||
|
||||
func loadTableView() {
|
||||
|
||||
tableView?.deleteIndexCallback = { [weak self] (index) in
|
||||
guard let _self = self else { return }
|
||||
_self.containers(remove: index)
|
||||
}
|
||||
tableView?.selectIndexCallback = { [weak self] (index) in
|
||||
guard let _self = self else { return }
|
||||
_self.containers[index].move(type: .top)
|
||||
}
|
||||
tableView?.didScrollCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.view.endEditing(true)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Navigation Bar Actions
|
||||
|
||||
@objc func navigationBarCloseAction(_ sender: UIBarButtonItem) {
|
||||
containers(remove: containers.count - 1)
|
||||
}
|
||||
|
||||
@objc func navigationBarAddAction(_ sender: UIBarButtonItem? = nil) {
|
||||
|
||||
let alert = UIAlertController(title: "Add Container",
|
||||
message: "together with ScrollView",
|
||||
preferredStyle: .actionSheet)
|
||||
|
||||
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
|
||||
|
||||
ExamplesContainerController.ScrollType.allCases.forEach { style in
|
||||
alert.addAction(UIAlertAction(title: style.rawValue,
|
||||
style: style == .tableAdapterView ? .destructive : .default,
|
||||
handler: { [weak self] _ in
|
||||
guard let _self = self else { return }
|
||||
_self.containers(addStyle: style)
|
||||
}))
|
||||
}
|
||||
|
||||
self.present(alert, animated: true)
|
||||
}
|
||||
|
||||
// MARK: - Add/Remove Container
|
||||
|
||||
func containers(addStyle containerStyle: ExamplesContainerController.ScrollType) {
|
||||
|
||||
switch containerStyle {
|
||||
case .mapsContainer: containers(add: MapsContainerController(addTo: self, darkStyle: false), style: containerStyle)
|
||||
case .locationContainer: containers(add: LocationContainerController(addTo: self, darkStyle: false), style: containerStyle)
|
||||
case .routeContainer: containers(add: RouteContainerController(addTo: self, darkStyle: false), style: containerStyle)
|
||||
case .menuContainer: containers(add: MenuContainerController(addTo: self, darkStyle: false, selectedIndex: 0), style: containerStyle)
|
||||
default: containers(add: ExamplesContainerController(addTo: self, style: containerStyle), style: containerStyle)
|
||||
}
|
||||
}
|
||||
|
||||
func containers(add container: ContainerController, style: ExamplesContainerController.ScrollType) {
|
||||
|
||||
container.move(type: .bottom, completion: {
|
||||
container.move(type: .top)
|
||||
})
|
||||
|
||||
containers.append(container)
|
||||
|
||||
let subTitle = String(describing: type(of: container))
|
||||
let title = style.rawValue
|
||||
|
||||
items.append( TitleTextItem(title: title, subtitle: subTitle, editing: true) )
|
||||
tableView?.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
func containers(remove index: Int) {
|
||||
if containers.isEmpty, items.isEmpty { return }
|
||||
|
||||
let container = containers[index]
|
||||
container.remove()
|
||||
|
||||
containers.remove(at: index)
|
||||
items.remove(at: index)
|
||||
|
||||
tableView?.set(items: items, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
//
|
||||
// ExampleCell.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by mrustaa on 28/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Cell Delegate
|
||||
|
||||
protocol ExampleCellDelegate {
|
||||
func exampleCell(_ cell: TableAdapterCell, type: ExampleCell.Style, value: CGFloat, endEditing: Bool)
|
||||
}
|
||||
|
||||
// MARK: - Cell Data
|
||||
|
||||
class ExampleCellData: TableAdapterCellData {
|
||||
|
||||
var delegate: ExampleCellDelegate?
|
||||
var callback: ((Int) -> Void)?
|
||||
|
||||
var type: ExampleCell.Style
|
||||
var title: String
|
||||
|
||||
var cellSizeHeight: CGFloat?
|
||||
|
||||
init(_ type: ExampleCell.Style,
|
||||
_ title: String?,
|
||||
_ cellHeight: CGFloat?,
|
||||
_ delegate: ExampleCellDelegate?,
|
||||
_ callback: ((Int) -> Void)?) {
|
||||
|
||||
self.type = type
|
||||
|
||||
if type != .default {
|
||||
self.title = type.rawValue
|
||||
} else {
|
||||
self.title = title ?? ""
|
||||
}
|
||||
|
||||
self.delegate = delegate
|
||||
self.callback = callback
|
||||
|
||||
self.cellSizeHeight = cellHeight
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return cellSizeHeight ?? 51.0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
//
|
||||
// ExampleCellStyle.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by mrustaa on 02/06/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Cell Style
|
||||
|
||||
class ExampleCell: TableAdapterCell {
|
||||
|
||||
}
|
||||
|
||||
extension ExampleCell {
|
||||
|
||||
public enum Style: String {
|
||||
case `default` = ""
|
||||
case shadowContainer = "ShadowContainer"
|
||||
case movingEnabled = "MovingEnabled"
|
||||
case cornerRadius = "CornerRadius"
|
||||
case footerPadding = "FooterView.Padding"
|
||||
case headerView = "HeaderView"
|
||||
case footerView = "FooterView"
|
||||
case color = "BackgroundColor"
|
||||
case blur = "Blur"
|
||||
case scroll = "ScrollView"
|
||||
case trackingPosition = "TrackingPosition"
|
||||
case scrollIndicatorInsetsTop = "↓ .Scroll.Indicator.Insets.Top"
|
||||
case scrollIndicatorInsetsBottom = "↑ .Scroll.Indicator.Insets.Bottom"
|
||||
case moveType = "MoveType"
|
||||
case top = "↓ .Top"
|
||||
case middle = "↑ .Middle"
|
||||
case bottom = "↑ .Bottom "
|
||||
case middleEnable = "MiddleEnable"
|
||||
case insetsRight = "Insets.Right"
|
||||
case insetsLeft = "Insets.Left"
|
||||
case shadowBackground = "ShadowBackground"
|
||||
case landscapeTop = "↓ Landscape.Top"
|
||||
case landscapeMiddle = "↑ Landscape.Middle"
|
||||
case landscapeBottom = "↑ Landscape.Bottom "
|
||||
case landscapeMiddleEnable = "Landscape.MiddleEnable"
|
||||
case landscapeInsetsRight = "Landscape.Insets.Right"
|
||||
case landscapeInsetsLeft = "Landscape.Insets.Left"
|
||||
case landscapeShadowBackground = "Landscape.ShadowBackground"
|
||||
}
|
||||
|
||||
}
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class ExampleSegmentCellItem: TableAdapterItem {
|
||||
|
||||
init(height: CGFloat? = nil,
|
||||
delegate: ExampleCellDelegate? = nil,
|
||||
type: ExampleCell.Style = .default,
|
||||
title: String? = nil,
|
||||
segmentItems: [String]? = nil,
|
||||
index: Int? = nil,
|
||||
callback: ((Int) -> Void)? = nil) {
|
||||
|
||||
let cellData = ExampleSegmentCellData(type, title, segmentItems, index, height, delegate, callback)
|
||||
|
||||
super.init(cellClass: ExampleSegmentCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class ExampleSegmentCellData: ExampleCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var segmentItems: [String]
|
||||
var selectIndex: Int
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ type: ExampleCell.Style,
|
||||
_ title: String?,
|
||||
_ segmentItems: [String]?,
|
||||
_ index: Int?,
|
||||
_ cellHeight: CGFloat?,
|
||||
_ delegate: ExampleCellDelegate?,
|
||||
_ callback: ((Int) -> Void)?) {
|
||||
|
||||
self.segmentItems = segmentItems ?? []
|
||||
self.selectIndex = index ?? 0
|
||||
|
||||
super.init(type, title, cellHeight, delegate, callback)
|
||||
}
|
||||
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 81
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class ExampleSegmentCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: ExampleSegmentCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var segmentControl: UISegmentedControl?
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
|
||||
// MARK: Load
|
||||
|
||||
override func awakeFromNib() {
|
||||
}
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? ExampleSegmentCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.text = data.title
|
||||
|
||||
segmentControl?.removeAllSegments()
|
||||
for (index, item) in data.segmentItems.enumerated() {
|
||||
segmentControl?.insertSegment(withTitle: item, at: index, animated: false)
|
||||
}
|
||||
segmentControl?.selectedSegmentIndex = data.selectIndex
|
||||
|
||||
}
|
||||
|
||||
@IBAction func segmentAction(_ sender: UISegmentedControl) {
|
||||
guard let data = data else { return }
|
||||
|
||||
let value = sender.selectedSegmentIndex
|
||||
data.selectIndex = value
|
||||
|
||||
data.callback?(value)
|
||||
data.delegate?.exampleCell(self, type: data.type, value: CGFloat(value), endEditing: true)
|
||||
}
|
||||
|
||||
}
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="ADc-Wu-299" customClass="ExampleSegmentCell" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="290" height="81"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="ADc-Wu-299" id="Qrk-n6-aPT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="290" height="81"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="751" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="WgT-5R-8In">
|
||||
<rect key="frame" x="10" y="38" width="270" height="32"/>
|
||||
<segments>
|
||||
<segment title="1"/>
|
||||
<segment title="2"/>
|
||||
</segments>
|
||||
<connections>
|
||||
<action selector="segmentAction:" destination="ADc-Wu-299" eventType="valueChanged" id="oIV-cV-3H2"/>
|
||||
</connections>
|
||||
</segmentedControl>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SegmentText" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aYC-50-jqf">
|
||||
<rect key="frame" x="10" y="12" width="270" height="16"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="aYC-50-jqf" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" constant="12" id="1NE-tQ-6YQ"/>
|
||||
<constraint firstItem="WgT-5R-8In" firstAttribute="top" secondItem="aYC-50-jqf" secondAttribute="bottom" constant="10" id="6hI-5U-Scq"/>
|
||||
<constraint firstAttribute="trailing" secondItem="WgT-5R-8In" secondAttribute="trailing" constant="10" id="9a8-wY-lLP"/>
|
||||
<constraint firstItem="WgT-5R-8In" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" constant="10" id="kj4-5u-Txa"/>
|
||||
<constraint firstAttribute="trailing" secondItem="aYC-50-jqf" secondAttribute="trailing" constant="10" id="s5D-0l-vbW"/>
|
||||
<constraint firstItem="aYC-50-jqf" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" constant="10" id="tNY-fx-JmB"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="segmentControl" destination="WgT-5R-8In" id="reJ-Vu-glv"/>
|
||||
<outlet property="titleLabel" destination="aYC-50-jqf" id="lUq-rA-0RO"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="54.399999999999999" y="101.19940029985008"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
-131
@@ -1,131 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class ExampleSliderCellItem: TableAdapterItem {
|
||||
|
||||
init(height: CGFloat? = nil,
|
||||
delegate: ExampleCellDelegate? = nil,
|
||||
type: ExampleCell.Style = .default,
|
||||
title: String? = nil,
|
||||
|
||||
value: Float? = nil,
|
||||
maximumValue: Float? = nil,
|
||||
minimumValue: Float? = nil,
|
||||
callback: ((Int) -> Void)? = nil) {
|
||||
|
||||
let cellData = ExampleSliderCellData(type, title, value, maximumValue, minimumValue, height, delegate, callback)
|
||||
|
||||
super.init(cellClass: ExampleSliderCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class ExampleSliderCellData: ExampleCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var value: Float
|
||||
var maximumValue: Float
|
||||
var minimumValue: Float
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ type: ExampleCell.Style,
|
||||
_ title: String? = nil,
|
||||
_ value: Float? = nil,
|
||||
_ maximumValue: Float? = nil,
|
||||
_ minimumValue: Float? = nil,
|
||||
_ cellHeight: CGFloat?,
|
||||
_ delegate: ExampleCellDelegate?,
|
||||
_ callback: ((Int) -> Void)?) {
|
||||
|
||||
let v = value ?? 1.0
|
||||
|
||||
self.value = v
|
||||
self.maximumValue = maximumValue ?? v
|
||||
self.minimumValue = minimumValue ?? 0.0
|
||||
|
||||
super.init(type, title, cellHeight, delegate, callback)
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 75.0
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class ExampleSliderCell: ExampleCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: ExampleSliderCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var slider: UISlider?
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet private weak var valueLabel: UILabel?
|
||||
|
||||
// MARK: Load
|
||||
|
||||
override func awakeFromNib() {
|
||||
}
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? ExampleSliderCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.text = data.title
|
||||
|
||||
slider?.maximumValue = data.maximumValue
|
||||
slider?.minimumValue = data.minimumValue
|
||||
slider?.value = data.value
|
||||
|
||||
if let slider = slider {
|
||||
let value = slider.value
|
||||
valueLabel?.text = String(format: "%.1f", value)
|
||||
data.value = value
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func sliderAction(_ sender: UISlider) {
|
||||
valueLabel(slider: sender)
|
||||
}
|
||||
|
||||
func valueLabel(slider: UISlider) {
|
||||
guard let data = data else { return }
|
||||
|
||||
let value = slider.value
|
||||
valueLabel?.text = String(format: "%.1f", value)
|
||||
data.value = value
|
||||
|
||||
data.callback?(Int(value))
|
||||
data.delegate?.exampleCell(self, type: data.type, value: CGFloat(value), endEditing: false)
|
||||
}
|
||||
|
||||
@IBAction func touchUpInside(_ slider: UISlider) {
|
||||
guard let data = data else { return }
|
||||
|
||||
let value = slider.value
|
||||
valueLabel?.text = String(format: "%.1f", value)
|
||||
data.value = value
|
||||
|
||||
data.callback?(Int(value))
|
||||
data.delegate?.exampleCell(self, type: data.type, value: CGFloat(value), endEditing: true)
|
||||
}
|
||||
|
||||
}
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="ADc-Wu-299" customClass="ExampleSliderCell" customModule="ContainerControllerSwift_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="242" height="75"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="ADc-Wu-299" id="Qrk-n6-aPT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="242" height="75"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SliderText" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aYC-50-jqf">
|
||||
<rect key="frame" x="10" y="12" width="201" height="16"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="0,5" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="V9W-av-foc">
|
||||
<rect key="frame" x="211" y="12" width="21" height="16"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="pdb-Rf-CXg">
|
||||
<rect key="frame" x="13" y="38" width="216" height="31"/>
|
||||
<connections>
|
||||
<action selector="sliderAction:" destination="ADc-Wu-299" eventType="valueChanged" id="z5E-op-Urc"/>
|
||||
<action selector="touchUpInside:" destination="ADc-Wu-299" eventType="touchUpInside" id="JqP-57-taD"/>
|
||||
</connections>
|
||||
</slider>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="V9W-av-foc" firstAttribute="leading" secondItem="aYC-50-jqf" secondAttribute="trailing" id="1ft-t2-02b"/>
|
||||
<constraint firstItem="aYC-50-jqf" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" constant="12" id="FmA-pS-CWQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="V9W-av-foc" secondAttribute="trailing" constant="10" id="NGh-VI-z5K"/>
|
||||
<constraint firstItem="pdb-Rf-CXg" firstAttribute="top" secondItem="aYC-50-jqf" secondAttribute="bottom" constant="10" id="XRx-az-qDG"/>
|
||||
<constraint firstItem="pdb-Rf-CXg" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" constant="15" id="j2i-5P-Zk0"/>
|
||||
<constraint firstAttribute="trailing" secondItem="pdb-Rf-CXg" secondAttribute="trailing" constant="15" id="kkE-oc-5w0"/>
|
||||
<constraint firstItem="V9W-av-foc" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" constant="12" id="qab-R3-dWu"/>
|
||||
<constraint firstItem="aYC-50-jqf" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" constant="10" id="tNY-fx-JmB"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="slider" destination="pdb-Rf-CXg" id="gqi-vt-LUP"/>
|
||||
<outlet property="titleLabel" destination="aYC-50-jqf" id="lUq-rA-0RO"/>
|
||||
<outlet property="valueLabel" destination="V9W-av-foc" id="mOS-8N-8GQ"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="20.800000000000001" y="99.400299850074973"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
-94
@@ -1,94 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class ExampleSwitchCellItem: TableAdapterItem {
|
||||
|
||||
init(height: CGFloat? = nil,
|
||||
delegate: ExampleCellDelegate? = nil,
|
||||
type: ExampleCell.Style = .default,
|
||||
title: String = "",
|
||||
value: Bool = false,
|
||||
callback: ((Int) -> Void)? = nil) {
|
||||
|
||||
let cellData = ExampleSwitchCellData(type, title, value, height, delegate, callback)
|
||||
|
||||
super.init(cellClass: ExampleSwitchCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class ExampleSwitchCellData: ExampleCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var value: Bool
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ type: ExampleCell.Style,
|
||||
_ title: String,
|
||||
_ value: Bool,
|
||||
_ cellHeight: CGFloat?,
|
||||
_ delegate: ExampleCellDelegate?,
|
||||
_ callback: ((Int) -> Void)?) {
|
||||
|
||||
self.value = value
|
||||
|
||||
super.init(type, title, cellHeight, delegate, callback)
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return cellSizeHeight ?? 51.0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class ExampleSwitchCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: ExampleSwitchCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var switchButton: UISwitch?
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
|
||||
// MARK: Load
|
||||
|
||||
override func awakeFromNib() {
|
||||
}
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? ExampleSwitchCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.text = data.title
|
||||
switchButton?.setOn(data.value, animated: false)
|
||||
}
|
||||
|
||||
@IBAction func switchAction(_ sender: UISwitch) {
|
||||
guard let data = data else { return }
|
||||
|
||||
let value = sender.isOn
|
||||
data.value = value
|
||||
|
||||
data.callback?((value ? 1 : 0))
|
||||
data.delegate?.exampleCell(self, type: data.type, value: (value ? 1 : 0), endEditing: true)
|
||||
}
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" id="ADc-Wu-299" customClass="ExampleSwitchCell" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="351" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="ADc-Wu-299" id="Qrk-n6-aPT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="351" height="51"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="SwitchText" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aYC-50-jqf">
|
||||
<rect key="frame" x="10" y="9.5" width="272" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="32" id="ygQ-Ul-8eS"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="13"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="BxP-OS-4Mu">
|
||||
<rect key="frame" x="292" y="10" width="51" height="31"/>
|
||||
<color key="onTintColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<connections>
|
||||
<action selector="switchAction:" destination="ADc-Wu-299" eventType="valueChanged" id="tC8-YJ-2yF"/>
|
||||
</connections>
|
||||
</switch>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="BxP-OS-4Mu" firstAttribute="leading" secondItem="aYC-50-jqf" secondAttribute="trailing" constant="10" id="Nor-jw-6Vp"/>
|
||||
<constraint firstItem="BxP-OS-4Mu" firstAttribute="centerY" secondItem="Qrk-n6-aPT" secondAttribute="centerY" id="OC2-nT-sr6"/>
|
||||
<constraint firstAttribute="trailing" secondItem="BxP-OS-4Mu" secondAttribute="trailing" constant="10" id="iXi-S4-icf"/>
|
||||
<constraint firstItem="aYC-50-jqf" firstAttribute="centerY" secondItem="Qrk-n6-aPT" secondAttribute="centerY" id="mME-6L-435"/>
|
||||
<constraint firstItem="aYC-50-jqf" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" constant="10" id="tNY-fx-JmB"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="switchButton" destination="BxP-OS-4Mu" id="Fzu-VA-frU"/>
|
||||
<outlet property="titleLabel" destination="aYC-50-jqf" id="lUq-rA-0RO"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="108" y="99.850074962518747"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
-117
@@ -1,117 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class TitleTextItem: TableAdapterItem {
|
||||
|
||||
init(title: String? = nil,
|
||||
subtitle: String? = nil,
|
||||
separator: Bool = false,
|
||||
clss: AnyClass? = nil,
|
||||
touchAnimationHide: Bool = false,
|
||||
editing: Bool = false) {
|
||||
|
||||
let cellData = TitleTextCellData(title, subtitle, separator, clss, touchAnimationHide, editing)
|
||||
|
||||
super.init(cellClass: TitleTextCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class TitleTextCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String?
|
||||
var subtitle: String?
|
||||
var clss: AnyClass?
|
||||
var separatorVisible: Bool
|
||||
var touchAnimationHide: Bool
|
||||
|
||||
var editing: Bool
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String? = nil,
|
||||
_ subtitle: String? = nil,
|
||||
_ separator: Bool,
|
||||
_ clss: AnyClass? = nil,
|
||||
_ touchAnimationHide: Bool,
|
||||
_ editing: Bool) {
|
||||
|
||||
self.title = title
|
||||
self.subtitle = subtitle
|
||||
|
||||
self.clss = clss
|
||||
|
||||
self.separatorVisible = separator
|
||||
self.touchAnimationHide = touchAnimationHide
|
||||
|
||||
self.editing = editing
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
|
||||
if title != nil {
|
||||
return 64
|
||||
} else {
|
||||
return 44
|
||||
}
|
||||
}
|
||||
|
||||
override public func canEditing() -> Bool {
|
||||
return editing
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class TitleTextCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: TitleTextCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet private weak var subtitleLabel: UILabel?
|
||||
@IBOutlet private weak var separatorView: UIView?
|
||||
@IBOutlet private weak var separatorHeightConstraint: NSLayoutConstraint?
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
separatorView?.backgroundColor = .clear
|
||||
separatorHeightConstraint?.constant = 0.5
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? TitleTextCellData else { return }
|
||||
self.data = data
|
||||
|
||||
// self._hideAnimation = data.touchAnimationHide
|
||||
|
||||
titleLabel?.text = data.title
|
||||
|
||||
subtitleLabel?.text = (data.clss != nil) ? classNameString(data.clss!) : data.subtitle
|
||||
|
||||
separatorView?.isHidden = !data.separatorVisible
|
||||
}
|
||||
|
||||
func classNameString(_ obj: Any) -> String {
|
||||
return String(describing: type(of: obj))
|
||||
}
|
||||
}
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" rowHeight="64" id="ADc-Wu-299" customClass="TitleTextCell" customModule="ContainerControllerSwift_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="64"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="ADc-Wu-299" id="Qrk-n6-aPT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="64"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Tite" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MbP-dL-b7J">
|
||||
<rect key="frame" x="16" y="12" width="360" height="14"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="14" id="ybu-0n-7d1"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Subtitle subtitle subtitle" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="erD-8k-fq0">
|
||||
<rect key="frame" x="16" y="32" width="360" height="19"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="19" id="DgX-EK-d6R"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="16"/>
|
||||
<color key="textColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="y4e-nG-Zu6">
|
||||
<rect key="frame" x="16" y="63" width="343" height="1"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="Mwb-A9-GWL"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="y4e-nG-Zu6" secondAttribute="trailing" constant="16" id="6tU-aV-NOW"/>
|
||||
<constraint firstItem="MbP-dL-b7J" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" constant="16" id="CVY-pT-bde"/>
|
||||
<constraint firstItem="y4e-nG-Zu6" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" constant="16" id="QFm-sF-aRI"/>
|
||||
<constraint firstItem="y4e-nG-Zu6" firstAttribute="top" secondItem="erD-8k-fq0" secondAttribute="bottom" constant="12" id="QZO-jk-KTF"/>
|
||||
<constraint firstItem="MbP-dL-b7J" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" constant="12" id="bPX-J8-yKW"/>
|
||||
<constraint firstItem="erD-8k-fq0" firstAttribute="trailing" secondItem="Qrk-n6-aPT" secondAttribute="trailingMargin" constant="16" id="coB-XR-Ksl"/>
|
||||
<constraint firstItem="erD-8k-fq0" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" constant="16" id="fId-PQ-DA7"/>
|
||||
<constraint firstAttribute="bottom" secondItem="y4e-nG-Zu6" secondAttribute="bottom" id="lV9-iJ-0gZ"/>
|
||||
<constraint firstItem="MbP-dL-b7J" firstAttribute="trailing" secondItem="Qrk-n6-aPT" secondAttribute="trailingMargin" constant="16" id="yAB-Bt-Wbb"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="separatorHeightConstraint" destination="Mwb-A9-GWL" id="PQz-KX-a42"/>
|
||||
<outlet property="separatorView" destination="y4e-nG-Zu6" id="iw9-9r-qpC"/>
|
||||
<outlet property="subtitleLabel" destination="erD-8k-fq0" id="Ggx-EQ-sNx"/>
|
||||
<outlet property="titleLabel" destination="MbP-dL-b7J" id="flI-3r-06U"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="127.2" y="111.54422788605699"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
-91
@@ -1,91 +0,0 @@
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
|
||||
class ExampleCollectionItem: CollectionAdapterItem {
|
||||
|
||||
init(width: CGFloat,
|
||||
padding: CGFloat,
|
||||
clickCallback: (() -> Void)? = nil) {
|
||||
|
||||
let cellData = ExampleCollectionCellData(width, padding, clickCallback)
|
||||
|
||||
super.init(cellClass: ExampleCollectionCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ExampleCollectionCellData: CollectionAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var width: CGFloat
|
||||
public var padding: CGFloat
|
||||
public var clickCallback: (() -> Void)?
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
public init (_ width: CGFloat,
|
||||
_ padding: CGFloat,
|
||||
_ clickCallback: (() -> Void)?) {
|
||||
|
||||
self.width = width
|
||||
self.padding = padding
|
||||
self.clickCallback = clickCallback
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func size() -> CGSize {
|
||||
let w = (width / 2) - ((padding / 2) * 3)
|
||||
return CGSize(width: w, height: w)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ExampleCollectionCell: CollectionAdapterCell {
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet weak var imageButton: DesignButton?
|
||||
@IBOutlet weak var titleLabel: UILabel?
|
||||
@IBOutlet weak var subtitleLabel: UILabel?
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: ExampleCollectionCellData?
|
||||
|
||||
override func awakeFromNib() {
|
||||
|
||||
}
|
||||
|
||||
override func fill(data: Any?) {
|
||||
|
||||
guard let data = data as? ExampleCollectionCellData else { return }
|
||||
self.data = data
|
||||
|
||||
let randomInt = Int.random(in: 0..<6)
|
||||
|
||||
var color: UIColor = .systemBlue
|
||||
|
||||
switch randomInt {
|
||||
case 0: color = .systemBlue
|
||||
case 1: color = .systemRed
|
||||
case 2: color = .systemGray
|
||||
case 3: color = .systemGreen
|
||||
case 4: color = .systemYellow
|
||||
case 5: color = .systemOrange
|
||||
default: break
|
||||
}
|
||||
|
||||
imageButton?.layer.backgroundColor = color.cgColor
|
||||
imageButton?.fillColor = color
|
||||
}
|
||||
|
||||
@IBAction func buttonClickAction(_ sender: Any) {
|
||||
data?.clickCallback?()
|
||||
}
|
||||
}
|
||||
-65
@@ -1,65 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="ExampleCollectionCell" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="135" height="132"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
||||
<rect key="frame" x="0.0" y="0.0" width="135" height="132"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LEH-bq-86c">
|
||||
<rect key="frame" x="0.0" y="0.0" width="135" height="132"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gSI-Iw-oJa" customClass="DesignButton" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="135" height="132"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="12"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.0" green="0.68235294120000001" blue="0.93725490199999995" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="buttonClickAction:" destination="gTV-IL-0wX" eventType="touchUpInside" id="h1P-jY-xGs"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="gSI-Iw-oJa" secondAttribute="bottom" id="G8K-Pi-exg"/>
|
||||
<constraint firstItem="gSI-Iw-oJa" firstAttribute="leading" secondItem="LEH-bq-86c" secondAttribute="leading" id="XMR-dX-hy2"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gSI-Iw-oJa" secondAttribute="trailing" id="jgw-rR-x72"/>
|
||||
<constraint firstItem="gSI-Iw-oJa" firstAttribute="top" secondItem="LEH-bq-86c" secondAttribute="top" id="x4f-qZ-COE"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="LEH-bq-86c" secondAttribute="trailing" id="G8N-J0-CSq"/>
|
||||
<constraint firstItem="LEH-bq-86c" firstAttribute="leading" secondItem="gTV-IL-0wX" secondAttribute="leading" id="dbr-mp-YyA"/>
|
||||
<constraint firstAttribute="bottom" secondItem="LEH-bq-86c" secondAttribute="bottom" id="hRo-ja-sYz"/>
|
||||
<constraint firstItem="LEH-bq-86c" firstAttribute="top" secondItem="gTV-IL-0wX" secondAttribute="top" id="lyJ-5L-dyH"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="ZTg-uK-7eu"/>
|
||||
<size key="customSize" width="135" height="132"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="hideAnimation" value="NO"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="imageButton" destination="gSI-Iw-oJa" id="qP3-Hl-7ap"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="113.768115942029" y="78.348214285714278"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
//
|
||||
// ExampleHeaderGripView.swift
|
||||
// GTDriver
|
||||
//
|
||||
// Created by mrustaa on 16/01/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ExampleFooterButtonView: XibView {
|
||||
|
||||
var buttonClickCallback: (() -> Void)?
|
||||
|
||||
// MARK: - IBOutlets
|
||||
|
||||
@IBOutlet public weak var separatorView: UIView?
|
||||
@IBOutlet weak var separatorHeight: NSLayoutConstraint?
|
||||
|
||||
override func loadedFromNib() {
|
||||
separatorHeight?.constant = 0.5
|
||||
separatorView?.alpha = 1.0
|
||||
}
|
||||
|
||||
@IBAction func buttonClickAction(_ sender: Any) {
|
||||
buttonClickCallback?()
|
||||
}
|
||||
}
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ExampleFooterButtonView" customModule="ContainerController" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="separatorHeight" destination="0TO-pN-EmM" id="CEV-uN-Ce9"/>
|
||||
<outlet property="separatorView" destination="Uen-Cc-5EB" id="aen-jw-8Vm"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="382" height="81"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Uen-Cc-5EB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="382" height="1"/>
|
||||
<color key="backgroundColor" white="0.49604060374149661" alpha="0.60400722789115646" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="0TO-pN-EmM"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pSo-VS-Su8" customClass="DesignButton" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="25" y="15" width="332" height="51"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="10" maxY="0.0"/>
|
||||
<state key="normal" title="Cancel"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="10"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.49463900862068966" alpha="0.51166487068965516" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
|
||||
<color key="value" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowRadius">
|
||||
<real key="value" value="3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="size" keyPath="shadowOffset">
|
||||
<size key="value" width="0.0" height="3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowOpacity">
|
||||
<real key="value" value="3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="buttonClickAction:" destination="-1" eventType="touchUpInside" id="wy8-Gf-0vo"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="pSo-VS-Su8" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="15" id="0SA-iS-hVR"/>
|
||||
<constraint firstItem="Uen-Cc-5EB" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="JRv-dy-R4j"/>
|
||||
<constraint firstAttribute="trailing" secondItem="pSo-VS-Su8" secondAttribute="trailing" constant="25" id="V1A-hR-aks"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Uen-Cc-5EB" secondAttribute="trailing" id="bia-iD-Dzg"/>
|
||||
<constraint firstAttribute="bottom" secondItem="pSo-VS-Su8" secondAttribute="bottom" constant="15" id="c8W-zh-zWe"/>
|
||||
<constraint firstItem="Uen-Cc-5EB" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="ga8-o1-mfN"/>
|
||||
<constraint firstItem="pSo-VS-Su8" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="25" id="zpk-vQ-dqa"/>
|
||||
</constraints>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<point key="canvasLocation" x="307.19999999999999" y="212.29385307346328"/>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
-28
@@ -1,28 +0,0 @@
|
||||
//
|
||||
// ExampleHeaderGripView.swift
|
||||
// GTDriver
|
||||
//
|
||||
// Created by mrustaa on 16/01/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class ExampleHeaderGripView: XibView {
|
||||
|
||||
var searchBarBeginEditingCallback: (() -> Void)?
|
||||
var searchBarCancelButtonClickedCallback: (() -> Void)?
|
||||
|
||||
// MARK: - IBOutlets
|
||||
|
||||
@IBOutlet public weak var separatorView: UIView?
|
||||
@IBOutlet weak var separatorHeight: NSLayoutConstraint?
|
||||
|
||||
override func loadedFromNib() {
|
||||
separatorHeight?.constant = 0.5
|
||||
separatorView?.alpha = 0.0
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
-68
@@ -1,68 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ExampleHeaderGripView" customModule="ContainerController" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="separatorHeight" destination="0TO-pN-EmM" id="CEV-uN-Ce9"/>
|
||||
<outlet property="separatorView" destination="Uen-Cc-5EB" id="aen-jw-8Vm"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" id="iN0-l3-epB">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2ea-2D-g1K" customClass="DesignView" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="142" y="5" width="36" height="5"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="5" id="4R5-pO-IGk"/>
|
||||
<constraint firstAttribute="width" constant="36" id="K4R-tH-ira"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="-1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.50980392156862742" green="0.50991177558898926" blue="0.50991177558898926" alpha="0.39849064624489788" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Uen-Cc-5EB">
|
||||
<rect key="frame" x="0.0" y="20" width="320" height="0.0"/>
|
||||
<color key="backgroundColor" white="0.49604060374149661" alpha="0.60400722789115646" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" id="0TO-pN-EmM"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="headerShadow.png" translatesAutoresizingMaskIntoConstraints="NO" id="IFV-VB-79V">
|
||||
<rect key="frame" x="0.0" y="20" width="320" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="w60-y2-XbQ"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Uen-Cc-5EB" firstAttribute="bottom" secondItem="iN0-l3-epB" secondAttribute="bottom" id="I9t-qK-dY0"/>
|
||||
<constraint firstAttribute="trailing" secondItem="IFV-VB-79V" secondAttribute="trailing" id="IMg-kh-WCM"/>
|
||||
<constraint firstItem="2ea-2D-g1K" firstAttribute="centerX" secondItem="iN0-l3-epB" secondAttribute="centerX" id="N4d-vR-36l"/>
|
||||
<constraint firstItem="2ea-2D-g1K" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="5" id="VHF-z8-u6m"/>
|
||||
<constraint firstItem="IFV-VB-79V" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" constant="20" id="arZ-KV-mud"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Uen-Cc-5EB" secondAttribute="trailing" id="bia-iD-Dzg"/>
|
||||
<constraint firstItem="IFV-VB-79V" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="eof-iW-Qux"/>
|
||||
<constraint firstItem="Uen-Cc-5EB" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="ga8-o1-mfN"/>
|
||||
</constraints>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<point key="canvasLocation" x="257.60000000000002" y="181.70914542728636"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="headerShadow.png" width="1170" height="75"/>
|
||||
</resources>
|
||||
</document>
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB |
Reference in New Issue
Block a user