Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5a6ac33d30 | |||
| 2efe85d480 | |||
| 74647ef9ba | |||
| 2a14634869 | |||
| 42f03ef1be | |||
| 4e56501f41 | |||
| 6236c59b73 | |||
| e140d52e21 | |||
| 9c3ba97d6b | |||
| 892a66c9b0 | |||
| 01997fcddd |
@@ -7,9 +7,9 @@
|
||||
#
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'ContainerControllerSwift'
|
||||
s.version = '1.0.2'
|
||||
s.summary = 'This is a swipe-panel from application: https://www.apple.com/ios/maps/'
|
||||
s.name = 'ContainerControllerSwift'
|
||||
s.version = '1.0.7'
|
||||
s.summary = 'This is a swipe-panel from application: https://www.apple.com/ios/maps/'
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
# * Think: What does it do? Why did you write it? What is the focus?
|
||||
@@ -17,24 +17,27 @@ Pod::Spec.new do |s|
|
||||
# * Write the description between the DESC delimiters below.
|
||||
# * Finally, don't worry about the indent, CocoaPods strips it!
|
||||
|
||||
s.description = <<-DESC
|
||||
s.description = <<-DESC
|
||||
TODO: Add long description of the pod here.
|
||||
'This is a swipe-panel from application: https://www.apple.com/ios/maps/'
|
||||
DESC
|
||||
|
||||
s.homepage = 'https://github.com/mrustaa/ContainerController'
|
||||
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'rustamburger@gmail.com' => 'rustamburger@gmail.com' }
|
||||
s.source = { :git => 'https://github.com/mrustaa/ContainerController.git', :tag => s.version.to_s }
|
||||
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
|
||||
s.homepage = 'https://github.com/mrustaa/ContainerController'
|
||||
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'mrustaa' => 'rustamburger@gmail.com' }
|
||||
s.source = { :git => 'https://github.com/mrustaa/ContainerController.git', :tag => s.version.to_s }
|
||||
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
|
||||
s.swift_version = "5.0"
|
||||
|
||||
s.swift_version = '5.2.4'
|
||||
s.ios.deployment_target = '13.0'
|
||||
# s.ios.deployment_target = '13.0'
|
||||
s.platform = :ios, "13.0"
|
||||
|
||||
s.source_files = 'ContainerControllerSwift/*.{swift}'
|
||||
s.source_files = 'ContainerControllerSwift/**/*.{swift}'
|
||||
|
||||
s.source_files = 'ContainerControllerSwift/*.{swift}'
|
||||
s.source_files = 'ContainerControllerSwift/ContainerTable/*.{swift}'
|
||||
s.source_files = 'ContainerControllerSwift/ContainerCollection/*.{swift}'
|
||||
s.framework = "UIKit"
|
||||
# s.ios.framework = 'UIKit'
|
||||
# s.resource_bundles = {
|
||||
# 'ContainerControllerSwift' => ['ContainerControllerSwift/Assets/*.png']
|
||||
# }
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Be sure to run `pod lib lint ContainerControllerSwift.podspec' to ensure this is a
|
||||
# valid spec before submitting.
|
||||
#
|
||||
# Any lines starting with a # are optional, but their use is encouraged
|
||||
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
|
||||
#
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'ContainerControllerSwift'
|
||||
s.version = '1.0.2'
|
||||
s.summary = 'This is a swipe-panel from application: https://www.apple.com/ios/maps/'
|
||||
|
||||
# This description is used to generate tags and improve search results.
|
||||
# * Think: What does it do? Why did you write it? What is the focus?
|
||||
# * Try to keep it short, snappy and to the point.
|
||||
# * Write the description between the DESC delimiters below.
|
||||
# * Finally, don't worry about the indent, CocoaPods strips it!
|
||||
|
||||
s.description = <<-DESC
|
||||
TODO: Add long description of the pod here.
|
||||
'This is a swipe-panel from application: https://www.apple.com/ios/maps/'
|
||||
DESC
|
||||
|
||||
s.homepage = 'https://github.com/mrustaa/ContainerController'
|
||||
# s.screenshots = 'www.example.com/screenshots_1', 'www.example.com/screenshots_2'
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
s.author = { 'rustamburger@gmail.com' => 'rustamburger@gmail.com' }
|
||||
s.source = { :git => 'https://github.com/mrustaa/ContainerController.git', :tag => s.version.to_s }
|
||||
# s.social_media_url = 'https://twitter.com/<TWITTER_USERNAME>'
|
||||
|
||||
s.swift_version = '5.2.4'
|
||||
s.ios.deployment_target = '13.0'
|
||||
|
||||
s.source_files = 'ContainerControllerSwift/*.{swift}'
|
||||
s.source_files = 'ContainerControllerSwift/**/*.{swift}'
|
||||
|
||||
# s.resource_bundles = {
|
||||
# 'ContainerControllerSwift' => ['ContainerControllerSwift/Assets/*.png']
|
||||
# }
|
||||
|
||||
# s.public_header_files = 'Pod/Classes/**/*.h'
|
||||
# s.frameworks = 'UIKit', 'MapKit'
|
||||
# s.dependency 'AFNetworking', '~> 2.3'
|
||||
end
|
||||
@@ -17,7 +17,7 @@ open class CollectionAdapterItem: NSObject {
|
||||
return String(describing: cellClass)
|
||||
}
|
||||
|
||||
init(cellClass: AnyClass, cellData: CollectionAdapterCellData? = nil) {
|
||||
public init(cellClass: AnyClass, cellData: CollectionAdapterCellData? = nil) {
|
||||
self.cellClass = cellClass
|
||||
self.cellData = cellData
|
||||
}
|
||||
|
||||
@@ -10,24 +10,24 @@ import UIKit
|
||||
|
||||
open class CollectionAdapterView: UICollectionView {
|
||||
|
||||
var countCallback: CollectionAdapterCountCallback?
|
||||
var cellIndexCallback: CollectionAdapterCellIndexCallback?
|
||||
var sizeIndexCallback: CollectionAdapterSizeIndexCallback?
|
||||
var selectIndexCallback: CollectionAdapterSelectIndexCallback?
|
||||
public var countCallback: CollectionAdapterCountCallback?
|
||||
public var cellIndexCallback: CollectionAdapterCellIndexCallback?
|
||||
public var sizeIndexCallback: CollectionAdapterSizeIndexCallback?
|
||||
public var selectIndexCallback: CollectionAdapterSelectIndexCallback?
|
||||
|
||||
var items: [CollectionAdapterItem] = []
|
||||
public var items: [CollectionAdapterItem] = []
|
||||
|
||||
required public init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
update()
|
||||
}
|
||||
|
||||
override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
|
||||
public override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
|
||||
super.init(frame: frame, collectionViewLayout: layout)
|
||||
update()
|
||||
}
|
||||
|
||||
func update() {
|
||||
public func update() {
|
||||
delegate = self
|
||||
dataSource = self
|
||||
backgroundColor = .clear
|
||||
|
||||
@@ -235,82 +235,82 @@ open class ContainerController: NSObject {
|
||||
|
||||
// MARK: - Update Layout
|
||||
|
||||
func set(layout: ContainerLayout) {
|
||||
public func set(layout: ContainerLayout) {
|
||||
self.layout = layout
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
// MARK: Set
|
||||
|
||||
func set(movingEnabled: Bool) {
|
||||
public func set(movingEnabled: Bool) {
|
||||
layout.movingEnabled = movingEnabled
|
||||
scrollView?.isScrollEnabled = movingEnabled
|
||||
panGesture?.isEnabled = movingEnabled
|
||||
}
|
||||
|
||||
func set(trackingPosition: Bool) {
|
||||
public func set(trackingPosition: Bool) {
|
||||
layout.trackingPosition = trackingPosition
|
||||
}
|
||||
|
||||
func set(footerPadding: CGFloat) {
|
||||
public func set(footerPadding: CGFloat) {
|
||||
layout.footerPadding = footerPadding
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
// MARK: Scroll Insets
|
||||
|
||||
func set(scrollIndicatorTop: CGFloat) {
|
||||
public func set(scrollIndicatorTop: CGFloat) {
|
||||
layout.scrollIndicatorInsets = UIEdgeInsets(top: scrollIndicatorTop, left: 0, bottom: layout.scrollIndicatorInsets.bottom, right: 0)
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
func set(scrollIndicatorBottom: CGFloat) {
|
||||
public func set(scrollIndicatorBottom: CGFloat) {
|
||||
layout.scrollIndicatorInsets = UIEdgeInsets(top: layout.scrollIndicatorInsets.top, left: 0, bottom: scrollIndicatorBottom, right: 0)
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
func set(scrollInsetsTop: CGFloat) {
|
||||
public func set(scrollInsetsTop: CGFloat) {
|
||||
layout.scrollInsets = UIEdgeInsets(top: scrollInsetsTop, left: 0, bottom: layout.scrollInsets.bottom, right: 0)
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
func set(scrollInsetsBottom: CGFloat) {
|
||||
public func set(scrollInsetsBottom: CGFloat) {
|
||||
layout.scrollInsets = UIEdgeInsets(top: layout.scrollInsets.top, left: 0, bottom: scrollInsetsBottom, right: 0)
|
||||
calculationViews()
|
||||
}
|
||||
|
||||
// MARK: Portrait
|
||||
|
||||
func set(top: CGFloat) {
|
||||
public func set(top: CGFloat) {
|
||||
layout.positions.top = top
|
||||
}
|
||||
|
||||
func set(middle: CGFloat?) {
|
||||
public func set(middle: CGFloat?) {
|
||||
layout.positions.middle = middle
|
||||
}
|
||||
|
||||
func set(bottom: CGFloat) {
|
||||
public func set(bottom: CGFloat) {
|
||||
layout.positions.bottom = bottom
|
||||
}
|
||||
|
||||
func set(right: CGFloat) {
|
||||
public func set(right: CGFloat) {
|
||||
layout.insets.right = right
|
||||
if isPortrait { calculationViews() }
|
||||
}
|
||||
|
||||
func set(left: CGFloat) {
|
||||
public func set(left: CGFloat) {
|
||||
layout.insets.left = left
|
||||
if isPortrait { calculationViews() }
|
||||
}
|
||||
|
||||
func set(backgroundShadowShow: Bool) {
|
||||
public func set(backgroundShadowShow: Bool) {
|
||||
layout.backgroundShadowShow = backgroundShadowShow
|
||||
if isPortrait { move(type: moveType) }
|
||||
}
|
||||
|
||||
// MARK: Landscape
|
||||
|
||||
func updateLandscapeLayout() {
|
||||
public func updateLandscapeLayout() {
|
||||
if layout.landscapePositions == nil {
|
||||
layout.landscapePositions = ContainerPosition.zero
|
||||
}
|
||||
@@ -319,34 +319,34 @@ open class ContainerController: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
func setLandscape(top: CGFloat) {
|
||||
public func setLandscape(top: CGFloat) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapePositions?.top = top
|
||||
}
|
||||
|
||||
func setLandscape(middle: CGFloat?) {
|
||||
public func setLandscape(middle: CGFloat?) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapePositions?.middle = middle
|
||||
}
|
||||
|
||||
func setLandscape(bottom: CGFloat) {
|
||||
public func setLandscape(bottom: CGFloat) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapePositions?.bottom = bottom
|
||||
}
|
||||
|
||||
func setLandscape(right: CGFloat) {
|
||||
public func setLandscape(right: CGFloat) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapeInsets?.right = right
|
||||
if !isPortrait { calculationViews() }
|
||||
}
|
||||
|
||||
func setLandscape(left: CGFloat) {
|
||||
public func setLandscape(left: CGFloat) {
|
||||
updateLandscapeLayout()
|
||||
layout.landscapeInsets?.left = left
|
||||
if !isPortrait { calculationViews() }
|
||||
}
|
||||
|
||||
func setLandscape(backgroundShadowShow: Bool) {
|
||||
public func setLandscape(backgroundShadowShow: Bool) {
|
||||
layout.landscapeBackgroundShadowShow = backgroundShadowShow
|
||||
if !isPortrait { move(type: moveType) }
|
||||
}
|
||||
|
||||
@@ -12,15 +12,15 @@ import UIKit
|
||||
|
||||
open class ContainerPosition {
|
||||
|
||||
var top: CGFloat
|
||||
public var top: CGFloat
|
||||
|
||||
var middle: CGFloat?
|
||||
public var middle: CGFloat?
|
||||
|
||||
var bottom: CGFloat
|
||||
public var bottom: CGFloat
|
||||
|
||||
static let zero = ContainerPosition(top: 0, bottom: 0)
|
||||
|
||||
init(top: CGFloat, middle: CGFloat? = nil, bottom: CGFloat) {
|
||||
public init(top: CGFloat, middle: CGFloat? = nil, bottom: CGFloat) {
|
||||
self.top = top
|
||||
self.middle = middle
|
||||
self.bottom = bottom
|
||||
@@ -32,13 +32,13 @@ open class ContainerPosition {
|
||||
|
||||
public struct ContainerInsets {
|
||||
|
||||
var right: CGFloat
|
||||
public var right: CGFloat
|
||||
|
||||
var left: CGFloat
|
||||
public var left: CGFloat
|
||||
|
||||
static let zero = ContainerInsets(right: 0, left: 0)
|
||||
|
||||
init(right: CGFloat, left: CGFloat) {
|
||||
public init(right: CGFloat, left: CGFloat) {
|
||||
self.right = right
|
||||
self.left = left
|
||||
}
|
||||
@@ -51,70 +51,74 @@ open class ContainerLayout {
|
||||
/**
|
||||
Initialization start position.
|
||||
*/
|
||||
var startPosition: ContainerMoveType = .hide
|
||||
public var startPosition: ContainerMoveType = .hide
|
||||
|
||||
/**
|
||||
Disables any moving with gestures.
|
||||
*/
|
||||
var movingEnabled: Bool = true
|
||||
public var movingEnabled: Bool = true
|
||||
|
||||
/**
|
||||
This is parameters for control footerView.
|
||||
Padding-top from containerView, if headerView is added, then its + height is summed.
|
||||
*/
|
||||
var footerPadding: CGFloat = 0.0
|
||||
public var footerPadding: CGFloat = 0.0
|
||||
|
||||
/**
|
||||
This is parameters for control FooterView.
|
||||
Tracking position ContainerView during animated movement.
|
||||
*/
|
||||
var trackingPosition: Bool = false
|
||||
public var trackingPosition: Bool = false
|
||||
|
||||
/**
|
||||
This is parameter contentInsets for transmission scrollView added containerView.
|
||||
*/
|
||||
var scrollInsets: UIEdgeInsets = UIEdgeInsets.zero
|
||||
public var scrollInsets: UIEdgeInsets = UIEdgeInsets.zero
|
||||
|
||||
/**
|
||||
This is parameter scrollIndicatorInsets for transmission scrollView added containerView.
|
||||
*/
|
||||
var scrollIndicatorInsets: UIEdgeInsets = UIEdgeInsets.zero
|
||||
public var scrollIndicatorInsets: UIEdgeInsets = UIEdgeInsets.zero
|
||||
|
||||
/**
|
||||
This parameter for portrait orientation.
|
||||
Sets the background shadow under container.
|
||||
*/
|
||||
var backgroundShadowShow: Bool = false
|
||||
public var backgroundShadowShow: Bool = false
|
||||
|
||||
/**
|
||||
This parameter for Portrait orientation
|
||||
Sets the new value for positions of animated movement (top, middle, bottom).
|
||||
*/
|
||||
var positions: ContainerPosition = ContainerPosition.zero
|
||||
public var positions: ContainerPosition = ContainerPosition.zero
|
||||
|
||||
/**
|
||||
This parameter for Portrait orientation.
|
||||
Insets for containerView (left, right).
|
||||
*/
|
||||
var insets: ContainerInsets = ContainerInsets.zero
|
||||
public var insets: ContainerInsets = ContainerInsets.zero
|
||||
|
||||
/**
|
||||
This parameter for Landscape orientation.
|
||||
Sets the background shadow under container. (Default: portrait backgroundShadowShow).
|
||||
*/
|
||||
var landscapeBackgroundShadowShow: Bool?
|
||||
public var landscapeBackgroundShadowShow: Bool?
|
||||
|
||||
/**
|
||||
This parameter for Landscape orientation.
|
||||
Sets the new value for positions of animated movement (top, middle, bottom). (Default: portrait positions).
|
||||
*/
|
||||
var landscapePositions: ContainerPosition?
|
||||
public var landscapePositions: ContainerPosition?
|
||||
|
||||
/**
|
||||
This parameter for Landscape orientation.
|
||||
Insets for containerView (left, right). (Default: portrait insets).
|
||||
*/
|
||||
var landscapeInsets: ContainerInsets?
|
||||
public var landscapeInsets: ContainerInsets?
|
||||
|
||||
public init() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,9 +11,9 @@ import UIKit
|
||||
open class TableAdapterCell: UITableViewCell {
|
||||
|
||||
@IBInspectable var hideAnimation: Bool = false
|
||||
var selectedView: UIView?
|
||||
open var selectedView: UIView?
|
||||
|
||||
var cellData: TableAdapterCellData?
|
||||
public var cellData: TableAdapterCellData?
|
||||
|
||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||
|
||||
@@ -18,7 +18,7 @@ open class TableAdapterItem: NSObject {
|
||||
return String(describing: cellClass)
|
||||
}
|
||||
|
||||
init(cellClass: AnyClass, cellData: TableAdapterCellData? = nil) {
|
||||
public init(cellClass: AnyClass, cellData: TableAdapterCellData? = nil) {
|
||||
self.cellClass = cellClass
|
||||
self.cellData = cellData
|
||||
}
|
||||
|
||||
@@ -12,22 +12,22 @@ open class TableAdapterView: UITableView {
|
||||
|
||||
@IBInspectable var separatorClr: UIColor?
|
||||
|
||||
var countCallback: TableAdapterCountCallback?
|
||||
var cellIndexCallback: TableAdapterCellIndexCallback?
|
||||
var heightIndexCallback: TableAdapterHeightIndexCallback?
|
||||
var selectIndexCallback: TableAdapterSelectIndexCallback?
|
||||
var deleteIndexCallback: TableAdapterDeleteIndexCallback?
|
||||
var didScrollCallback: TableAdapterDidScrollCallback?
|
||||
public var countCallback: TableAdapterCountCallback?
|
||||
public var cellIndexCallback: TableAdapterCellIndexCallback?
|
||||
public var heightIndexCallback: TableAdapterHeightIndexCallback?
|
||||
public var selectIndexCallback: TableAdapterSelectIndexCallback?
|
||||
public var deleteIndexCallback: TableAdapterDeleteIndexCallback?
|
||||
public var didScrollCallback: TableAdapterDidScrollCallback?
|
||||
|
||||
|
||||
var items: [TableAdapterItem] = []
|
||||
public var items: [TableAdapterItem] = []
|
||||
|
||||
required public init?(coder: NSCoder) {
|
||||
super.init(coder: coder)
|
||||
update()
|
||||
}
|
||||
|
||||
override init(frame: CGRect, style: UITableView.Style) {
|
||||
public override init(frame: CGRect, style: UITableView.Style) {
|
||||
super.init(frame: frame, style: style)
|
||||
update()
|
||||
}
|
||||
@@ -38,7 +38,7 @@ open class TableAdapterView: UITableView {
|
||||
}
|
||||
}
|
||||
|
||||
func update() {
|
||||
public func update() {
|
||||
delegate = self
|
||||
dataSource = self
|
||||
|
||||
@@ -46,7 +46,7 @@ open class TableAdapterView: UITableView {
|
||||
backgroundColor = .clear
|
||||
}
|
||||
|
||||
func set(items: [TableAdapterItem], animated: Bool = false, reload: Bool = true) {
|
||||
public func set(items: [TableAdapterItem], animated: Bool = false, reload: Bool = true) {
|
||||
self.clear()
|
||||
items.forEach {
|
||||
self.unsafeAdd(item: $0)
|
||||
|
||||
@@ -10,13 +10,13 @@ import UIKit
|
||||
|
||||
open class ContainerView: UIView {
|
||||
|
||||
var contentView: UIView?
|
||||
public var contentView: UIView?
|
||||
|
||||
var visualEffectView: UIVisualEffectView?
|
||||
public var visualEffectView: UIVisualEffectView?
|
||||
|
||||
// MARK: CornerRadius
|
||||
|
||||
var cornerRadius: CGFloat = 0 {
|
||||
public var cornerRadius: CGFloat = 0 {
|
||||
didSet {
|
||||
let r = radius()
|
||||
layer.cornerRadius = r
|
||||
@@ -26,7 +26,7 @@ open class ContainerView: UIView {
|
||||
}
|
||||
}
|
||||
|
||||
func radius() -> CGFloat {
|
||||
public func radius() -> CGFloat {
|
||||
let minSize = min(frame.width, frame.height)
|
||||
let radius = (((minSize / 2) < cornerRadius) ? (minSize / 2) : cornerRadius)
|
||||
return radius
|
||||
@@ -34,7 +34,7 @@ open class ContainerView: UIView {
|
||||
|
||||
// MARK: Init
|
||||
|
||||
override init(frame: CGRect) {
|
||||
public override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
let contentView = UIView(frame: CGRect(x: 0, y: 0, width: frame.width, height: frame.height))
|
||||
@@ -50,7 +50,7 @@ open class ContainerView: UIView {
|
||||
|
||||
// MARK: Add Custom Shadow
|
||||
|
||||
func addShadow(opacity: CGFloat = 0.1) {
|
||||
public func addShadow(opacity: CGFloat = 0.1) {
|
||||
layer.shadowOpacity = Float(opacity)
|
||||
layer.shadowColor = UIColor.black.cgColor
|
||||
layer.shadowRadius = 3
|
||||
@@ -58,13 +58,13 @@ open class ContainerView: UIView {
|
||||
|
||||
// MARK: Add Blur
|
||||
|
||||
func addBlur(darkStyle: Bool) {
|
||||
public func addBlur(darkStyle: Bool) {
|
||||
let style: UIBlurEffect.Style = darkStyle ? .systemThinMaterialDark : .systemChromeMaterialLight
|
||||
backgroundColor = .clear
|
||||
addBlur(style: style)
|
||||
}
|
||||
|
||||
func addBlur(style: UIBlurEffect.Style) {
|
||||
public func addBlur(style: UIBlurEffect.Style) {
|
||||
|
||||
if visualEffectView == nil {
|
||||
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: style))
|
||||
@@ -84,7 +84,7 @@ open class ContainerView: UIView {
|
||||
|
||||
// MARK: Remove Blur
|
||||
|
||||
func removeBlur() {
|
||||
public func removeBlur() {
|
||||
if let visualEffectView = visualEffectView {
|
||||
visualEffectView.removeFromSuperview()
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,30 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="vXZ-lx-hvc">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<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" initialViewController="aV9-EX-QWJ">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
|
||||
<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>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="ufC-wZ-h7g">
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="vXZ-lx-hvc" customClass="ViewController" customModule="ContainerControllerSwift_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="jyV-Pf-zRb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModule="ContainerControllerSwift_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="623"/>
|
||||
<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="UYm-tY-WGa" customClass="TableAdapterView" customModule="ContainerControllerSwift">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="623"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="bottom" secondItem="UYm-tY-WGa" secondAttribute="bottom" id="Usw-ep-vba"/>
|
||||
<constraint firstItem="UYm-tY-WGa" firstAttribute="top" secondItem="6Tk-OE-BBY" secondAttribute="top" id="qmS-hQ-rSa"/>
|
||||
<constraint firstItem="6Tk-OE-BBY" firstAttribute="trailing" secondItem="UYm-tY-WGa" secondAttribute="trailing" id="vQK-T0-eQf"/>
|
||||
<constraint firstItem="UYm-tY-WGa" firstAttribute="leading" secondItem="6Tk-OE-BBY" secondAttribute="leading" id="wXp-OO-MUn"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" id="x48-lm-dG7"/>
|
||||
<connections>
|
||||
<outlet property="tableView" destination="UYm-tY-WGa" id="djd-oP-Z2M"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="132" y="137.18140929535232"/>
|
||||
</scene>
|
||||
<!--Light Content Navigation Controller-->
|
||||
<scene sceneID="2WA-6t-2aK">
|
||||
<objects>
|
||||
<navigationController id="aV9-EX-QWJ" customClass="LightContentNavigationController" customModule="ContainerControllerSwift_Example" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<navigationBar key="navigationBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translucent="NO" id="QWK-gZ-mYK">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
</navigationBar>
|
||||
<connections>
|
||||
<segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="SPa-ED-zkK"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Uhq-S7-WHN" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-631" y="137"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
<?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 Add Table View Controller-->
|
||||
<scene sceneID="0f9-5i-ygC">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="ExamplesAddTableViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="p3c-kf-PfN" customClass="ExamplesAddTableViewController" 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"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<viewLayoutGuide key="safeArea" id="QCP-uk-H24"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Uzt-sR-4xA" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="781.15942028985512" y="43.526785714285715"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
+273
@@ -0,0 +1,273 @@
|
||||
//
|
||||
// ExamplesAddTableViewController.swift
|
||||
// ContainerControllerSwift
|
||||
//
|
||||
// Created by mrustaa on 09.06.2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class ExamplesAddTableViewController: StoryboardController {
|
||||
|
||||
var containerTable: ContainerController!
|
||||
var containerCollection: ContainerController!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
|
||||
let layout = ContainerLayout()
|
||||
layout.backgroundShadowShow = true
|
||||
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 100)
|
||||
containerTable = ContainerController(addTo: self, layout: layout)
|
||||
containerTable.view.cornerRadius = 15
|
||||
containerTable.view.addShadow()
|
||||
containerTable.add(scrollView: addTableView())
|
||||
|
||||
|
||||
let layoutC = ContainerLayout()
|
||||
layoutC.positions = ContainerPosition(top: 100, middle: 250, bottom: 70)
|
||||
containerCollection = ContainerController(addTo: self, layout: layoutC)
|
||||
containerCollection.view.cornerRadius = 15
|
||||
containerCollection.view.addShadow()
|
||||
containerCollection.add(scrollView: addCollectionView())
|
||||
}
|
||||
|
||||
override var prefersStatusBarHidden: Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
containerTable.move(type: .top, completion: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
_self.containerCollection.move(type: .middle)
|
||||
})
|
||||
}
|
||||
|
||||
func addTableView() -> UITableView {
|
||||
|
||||
let tableView = UITableView()
|
||||
tableView.register(UITableViewCell.self, forCellReuseIdentifier: "cell")
|
||||
tableView.delegate = self
|
||||
tableView.dataSource = self
|
||||
return tableView
|
||||
}
|
||||
|
||||
func addCollectionView() -> UICollectionView {
|
||||
|
||||
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 = UICollectionView(frame: CGRect.zero, collectionViewLayout: layout)
|
||||
colletion.register(UICollectionViewCell.self, forCellWithReuseIdentifier: "cell")
|
||||
colletion.backgroundColor = .clear
|
||||
colletion.delegate = self
|
||||
colletion.dataSource = self
|
||||
return colletion
|
||||
}
|
||||
|
||||
func changeViewParametrs() {
|
||||
|
||||
containerTable.view.cornerRadius = 15 // Change cornerRadius global
|
||||
containerTable.view.addShadow(opacity: 0.1) // Add layer shadow
|
||||
containerTable.view.addBlur(style: .dark) // Add background blur UIVisualEffectView
|
||||
}
|
||||
|
||||
func changeViewCustom() {
|
||||
|
||||
// Add custom shadow
|
||||
let layer = containerTable.view.layer
|
||||
layer.shadowOpacity = 0.5
|
||||
layer.shadowColor = UIColor.red.cgColor
|
||||
layer.shadowOffset = CGSize(width: 1, height: 4)
|
||||
layer.shadowRadius = 5
|
||||
|
||||
// Add view in container.view
|
||||
let viewRed = UIView(frame: CGRect(x: 50, y: 50, width: 50, height: 50))
|
||||
viewRed.backgroundColor = .systemRed
|
||||
containerTable.view.addSubview(viewRed)
|
||||
|
||||
// Add view under scrollView container.view
|
||||
let viewGreen = UIView(frame: CGRect(x: 25, y: 25, width: 50, height: 50))
|
||||
viewGreen.backgroundColor = .systemGreen
|
||||
containerTable.view.insertSubview(viewGreen, at: 0)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Settings
|
||||
|
||||
|
||||
|
||||
func createLayout() {
|
||||
|
||||
let layout = ContainerLayout()
|
||||
layout.startPosition = .hide
|
||||
layout.backgroundShadowShow = false
|
||||
layout.positions = ContainerPosition(top: 70, middle: 250, bottom: 70)
|
||||
|
||||
}
|
||||
|
||||
// MARK: - change settings right away
|
||||
|
||||
func changeRightAway() {
|
||||
|
||||
// Properties
|
||||
containerTable.set(movingEnabled: true)
|
||||
containerTable.set(trackingPosition: false)
|
||||
containerTable.set(footerPadding: 100)
|
||||
|
||||
// Add ScrollInsets Top/Bottom
|
||||
containerTable.set(scrollIndicatorTop: 5) // ↓
|
||||
containerTable.set(scrollIndicatorBottom: 5) // ↑
|
||||
|
||||
// Positions
|
||||
containerTable.set(top: 70) // ↓
|
||||
containerTable.set(middle: 250) // ↑
|
||||
containerTable.set(bottom: 80) // ↑
|
||||
|
||||
// Middle Enable/Disable
|
||||
containerTable.set(middle: 250)
|
||||
containerTable.set(middle: nil)
|
||||
|
||||
// Background Shadow
|
||||
containerTable.set(backgroundShadowShow: true)
|
||||
|
||||
// Insets View
|
||||
containerTable.set(left: 5) // →
|
||||
containerTable.set(right: 5) // ←
|
||||
|
||||
// Landscape params
|
||||
containerTable.setLandscape(top: 30)
|
||||
containerTable.setLandscape(middle: 150)
|
||||
containerTable.setLandscape(bottom: 70)
|
||||
containerTable.setLandscape(middle: nil)
|
||||
|
||||
containerTable.setLandscape(backgroundShadowShow: false)
|
||||
|
||||
containerTable.setLandscape(left: 10)
|
||||
containerTable.setLandscape(right: 100)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Scroll Delegate
|
||||
|
||||
extension ExamplesAddTableViewController: UIScrollViewDelegate {
|
||||
|
||||
func scrollViewDidScroll(_ scrollView: UIScrollView) {
|
||||
if let table = scrollView as? UITableView {
|
||||
containerTable.scrollViewDidScroll(table)
|
||||
}
|
||||
if let colletion = scrollView as? UICollectionView {
|
||||
containerCollection.scrollViewDidScroll(colletion)
|
||||
}
|
||||
}
|
||||
|
||||
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
||||
if let table = scrollView as? UITableView {
|
||||
containerTable.scrollViewWillBeginDragging(table)
|
||||
}
|
||||
if let colletion = scrollView as? UICollectionView {
|
||||
containerCollection.scrollViewWillBeginDragging(colletion)
|
||||
}
|
||||
}
|
||||
|
||||
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
|
||||
if let table = scrollView as? UITableView {
|
||||
containerTable.scrollViewDidEndDecelerating(table)
|
||||
}
|
||||
if let colletion = scrollView as? UICollectionView {
|
||||
containerCollection.scrollViewDidEndDecelerating(colletion)
|
||||
}
|
||||
}
|
||||
|
||||
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
|
||||
if let table = scrollView as? UITableView {
|
||||
containerTable.scrollViewDidEndDragging(table, willDecelerate: decelerate)
|
||||
}
|
||||
if let colletion = scrollView as? UICollectionView {
|
||||
containerCollection.scrollViewDidEndDragging(colletion, willDecelerate: decelerate)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Collection DataSource
|
||||
|
||||
extension ExamplesAddTableViewController: UICollectionViewDataSource {
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
|
||||
return 17
|
||||
}
|
||||
|
||||
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
|
||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
cell.backgroundColor = color
|
||||
cell.layer.cornerRadius = 12
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Collection Layout
|
||||
|
||||
extension ExamplesAddTableViewController: UICollectionViewDelegateFlowLayout {
|
||||
|
||||
public func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
|
||||
let size = ((ContainerDevice.width / 2) - 1) - 22
|
||||
return CGSize(width: size, height: size)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// MARK: - Table Delegate
|
||||
|
||||
extension ExamplesAddTableViewController: UITableViewDelegate {
|
||||
|
||||
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||
return 60
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Table DataSource
|
||||
|
||||
extension ExamplesAddTableViewController: UITableViewDataSource {
|
||||
|
||||
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
||||
return 21
|
||||
}
|
||||
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
|
||||
cell.textLabel?.text = "item \(indexPath.row)"
|
||||
cell.backgroundColor = .clear
|
||||
return cell
|
||||
}
|
||||
}
|
||||
|
||||
+273
@@ -0,0 +1,273 @@
|
||||
//
|
||||
// ExamplesContainerController.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 31/05/2020.
|
||||
// Copyright © 2020 mrusta. 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
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// ExamplesContainerControllerScrollType.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 03/06/2020.
|
||||
// Copyright © 2020 mrusta. 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
@@ -0,0 +1,138 @@
|
||||
//
|
||||
// ExamplesScrollViews.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 30/05/2020.
|
||||
// Copyright © 2020 mrusta. 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
@@ -0,0 +1,41 @@
|
||||
<?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>
|
||||
+128
@@ -0,0 +1,128 @@
|
||||
|
||||
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
|
||||
override var prefersStatusBarHidden: Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
// 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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
//
|
||||
// ExampleCell.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 28/05/2020.
|
||||
// Copyright © 2020 mrusta. 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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// ExampleCellStyle.swift
|
||||
// ContainerController
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 02/06/2020.
|
||||
// Copyright © 2020 mrusta. 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
@@ -0,0 +1,106 @@
|
||||
|
||||
|
||||
|
||||
|
||||
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
@@ -0,0 +1,53 @@
|
||||
<?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
@@ -0,0 +1,131 @@
|
||||
|
||||
|
||||
|
||||
|
||||
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
@@ -0,0 +1,59 @@
|
||||
<?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
@@ -0,0 +1,94 @@
|
||||
|
||||
|
||||
|
||||
|
||||
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
@@ -0,0 +1,52 @@
|
||||
<?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
@@ -0,0 +1,117 @@
|
||||
|
||||
|
||||
|
||||
|
||||
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
@@ -0,0 +1,66 @@
|
||||
<?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" rowHeight="64" id="ADc-Wu-299" customClass="TitleTextCell" customModule="ContainerController" 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="Контроллер" 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="Введите название компании" 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
@@ -0,0 +1,91 @@
|
||||
|
||||
|
||||
|
||||
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
@@ -0,0 +1,65 @@
|
||||
<?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
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// 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
@@ -0,0 +1,72 @@
|
||||
<?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
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// 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
@@ -0,0 +1,68 @@
|
||||
<?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.
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,151 @@
|
||||
|
||||
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
class DesignButton: UIButton {
|
||||
|
||||
/*
|
||||
// @IBInspectable var cornerRadius: CGFloat = 0.0 {
|
||||
// didSet {
|
||||
// let minSize = min(frame.size.width, frame.size.height)
|
||||
// let radius = ((cornerRadius < 0) ? (minSize / 2) : cornerRadius)
|
||||
// self.layer.cornerRadius = radius
|
||||
// }
|
||||
// }
|
||||
|
||||
// UIGraphicsBeginImageContextWithOptions(glayer.frame.size, false, UIScreen.main.scale)
|
||||
// UIGraphicsBeginImageContext(glayer.frame.size)
|
||||
// glayer.render(in:UIGraphicsGetCurrentContext()!)
|
||||
// let image = UIGraphicsGetImageFromCurrentImageContext()
|
||||
// UIGraphicsEndImageContext()
|
||||
// setImage(image, for: .normal)
|
||||
*/
|
||||
|
||||
@IBInspectable var hideAnimation: Bool = true
|
||||
|
||||
@IBInspectable var fillColor: UIColor = .clear
|
||||
|
||||
@IBInspectable var gradientColor: UIColor?
|
||||
@IBInspectable var gradientOffset: CGPoint = CGPoint(x: 0, y: 1)
|
||||
|
||||
@IBInspectable var cornerRadius: CGFloat = 0.0
|
||||
|
||||
@IBInspectable var shadowColor: UIColor = .clear
|
||||
@IBInspectable var shadowOffset: CGSize = CGSize.zero
|
||||
@IBInspectable var shadowRadius: CGFloat = 0.0
|
||||
@IBInspectable var shadowOpacity: CGFloat = 0.0
|
||||
|
||||
@IBInspectable var borderColor: UIColor = .clear
|
||||
@IBInspectable var borderWidth: CGFloat = 0.0
|
||||
|
||||
override func draw(_ rect: CGRect) {
|
||||
|
||||
if let gradientColor = gradientColor {
|
||||
|
||||
let glayer = CAGradientLayer()
|
||||
glayer.frame = bounds
|
||||
glayer.colors = [fillColor.cgColor, gradientColor.cgColor]
|
||||
glayer.startPoint = CGPoint.zero
|
||||
glayer.endPoint = gradientOffset
|
||||
glayer.cornerRadius = radius()
|
||||
layer.insertSublayer(glayer, at: 0)
|
||||
|
||||
} else {
|
||||
layer.backgroundColor = fillColor.cgColor
|
||||
}
|
||||
|
||||
layer.cornerRadius = radius()
|
||||
|
||||
layer.shadowOffset = shadowOffset
|
||||
layer.shadowOpacity = Float(shadowOpacity / 10.0)
|
||||
layer.shadowRadius = shadowRadius
|
||||
layer.shadowColor = shadowColor.cgColor
|
||||
|
||||
layer.borderColor = borderColor.cgColor
|
||||
layer.borderWidth = borderWidth
|
||||
}
|
||||
|
||||
override var isSelected: Bool {
|
||||
didSet {
|
||||
super.isSelected = isSelected
|
||||
}
|
||||
}
|
||||
|
||||
override var isHighlighted: Bool {
|
||||
didSet {
|
||||
// super.isHighlighted = isHighlighted
|
||||
}
|
||||
}
|
||||
|
||||
override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
selectedLayer(show: true)
|
||||
return super.beginTracking(touch, with: event)
|
||||
}
|
||||
|
||||
override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
||||
let point = touch.location(in: self)
|
||||
let someFrame = bounds
|
||||
let highlighted = someFrame.contains(point)
|
||||
selectedLayer(show: highlighted)
|
||||
return super.continueTracking(touch, with: event)
|
||||
}
|
||||
|
||||
override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
||||
selectedLayer(show: false)
|
||||
super.endTracking(touch, with: event)
|
||||
}
|
||||
|
||||
override func cancelTracking(with event: UIEvent?) {
|
||||
selectedLayer(show: false)
|
||||
super.cancelTracking(with: event)
|
||||
}
|
||||
|
||||
func radius() -> CGFloat {
|
||||
let minSize = min(frame.size.width, frame.size.height)
|
||||
let radius = ((cornerRadius < 0) ? (minSize / 2) : cornerRadius)
|
||||
return radius
|
||||
}
|
||||
|
||||
func selectedLayer(show: Bool) {
|
||||
|
||||
func selectAnimationHide(show: Bool) {
|
||||
if show {
|
||||
alpha = 0.5
|
||||
} else {
|
||||
UIView.animate(withDuration: 0.35, animations: {
|
||||
self.alpha = 1
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func selectAnimationShadow(show: Bool) {
|
||||
let tag = 1
|
||||
let view = viewWithTag(tag)
|
||||
if show {
|
||||
if view == nil {
|
||||
let view = UIView(frame: bounds)
|
||||
view.backgroundColor = UIColor.init(white: 0.0, alpha: 0.2)
|
||||
view.tag = tag
|
||||
view.layer.cornerRadius = radius()
|
||||
addSubview(view)
|
||||
}
|
||||
} else {
|
||||
if let view = view {
|
||||
UIView.animate(withDuration: 0.35, animations: {
|
||||
view.alpha = 0
|
||||
}) { (fin: Bool) in
|
||||
view.removeFromSuperview()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if hideAnimation {
|
||||
selectAnimationHide(show: show)
|
||||
} else {
|
||||
selectAnimationShadow(show: show)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
|
||||
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
class DesignView: UIView {
|
||||
|
||||
@IBInspectable var fillColor: UIColor = .clear
|
||||
|
||||
//MARK: - Gradient
|
||||
|
||||
@IBInspectable var gradientColor: UIColor?
|
||||
@IBInspectable var gradientColor2: UIColor?
|
||||
@IBInspectable var gradientColor3: UIColor?
|
||||
@IBInspectable var gradientStartPoint: CGPoint = CGPoint.zero
|
||||
@IBInspectable var gradientOffset: CGPoint = CGPoint(x: 0, y: 1)
|
||||
|
||||
//MARK: - Shadow
|
||||
|
||||
@IBInspectable var shadowColor: UIColor = .clear
|
||||
@IBInspectable var shadowOffset: CGSize = CGSize.zero
|
||||
@IBInspectable var shadowRadius: CGFloat = 0.0
|
||||
@IBInspectable var shadowOpacity: CGFloat = 0.0
|
||||
|
||||
//MARK: - Radius
|
||||
|
||||
@IBInspectable var cornerRadius: CGFloat = 0.0
|
||||
|
||||
//MARK: - Border
|
||||
|
||||
@IBInspectable var borderColor: UIColor = .clear
|
||||
@IBInspectable var borderWidth: CGFloat = 0.0
|
||||
|
||||
override func draw(_ rect: CGRect) {
|
||||
|
||||
if let gradientColor = gradientColor {
|
||||
|
||||
var colors: [CGColor] = []
|
||||
colors.append(fillColor.cgColor)
|
||||
colors.append(gradientColor.cgColor)
|
||||
if let gradientColor2 = gradientColor2 { colors.append(gradientColor2.cgColor) }
|
||||
if let gradientColor3 = gradientColor3 { colors.append(gradientColor3.cgColor) }
|
||||
|
||||
let glayer = CAGradientLayer()
|
||||
glayer.frame = bounds
|
||||
glayer.colors = colors
|
||||
glayer.startPoint = gradientStartPoint
|
||||
glayer.endPoint = gradientOffset
|
||||
glayer.cornerRadius = radius()
|
||||
layer.insertSublayer(glayer, at: 0)
|
||||
|
||||
} else {
|
||||
layer.backgroundColor = fillColor.cgColor
|
||||
}
|
||||
|
||||
layer.cornerRadius = radius()
|
||||
|
||||
layer.shadowOffset = shadowOffset
|
||||
layer.shadowOpacity = Float(shadowOpacity / 10.0)
|
||||
layer.shadowRadius = shadowRadius
|
||||
layer.shadowColor = shadowColor.cgColor
|
||||
|
||||
layer.borderColor = borderColor.cgColor
|
||||
layer.borderWidth = borderWidth
|
||||
}
|
||||
|
||||
func radius() -> CGFloat {
|
||||
let minSize = min(width, height)
|
||||
let radius = ((cornerRadius < 0) ? (minSize / 2) : cornerRadius)
|
||||
return radius
|
||||
}
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// StoryboardController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 20/04/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
class StoryboardController: UIViewController {
|
||||
|
||||
class func instantiate() -> UIViewController {
|
||||
return fromStoryboardController()
|
||||
}
|
||||
|
||||
class func fromStoryboardController() -> UIViewController {
|
||||
let className = String(describing: self)
|
||||
|
||||
let storyboard = UIStoryboard.init(name: className, bundle: nil)
|
||||
|
||||
// if let initialViewController = storyboard.instantiateInitialViewController() {
|
||||
// return initialViewController
|
||||
// } else {
|
||||
// fatalError("Can't initialize view controller \(self)")
|
||||
// }
|
||||
|
||||
return storyboard.instantiateViewController(withIdentifier: className)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
//
|
||||
// XibView.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by Рустам Мотыгуллин on 19/04/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class XibView: UIView {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
public weak var contentView: UIView?
|
||||
|
||||
// MARK: - Initialize
|
||||
|
||||
required public init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
contentView = fromNib()
|
||||
loadedFromNib()
|
||||
}
|
||||
|
||||
public init() {
|
||||
super.init(frame: CGRect.zero)
|
||||
contentView = fromNib()
|
||||
frame = contentView?.frame ?? frame
|
||||
loadedFromNib()
|
||||
}
|
||||
|
||||
// MARK: - Postflight
|
||||
|
||||
open func loadedFromNib() {
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Load Nib
|
||||
|
||||
func fromNibWithoutConstraints() -> UIView? {
|
||||
guard let contentView = Bundle(for: type(of: self)).loadNibNamed(String(describing: type(of: self)), owner: self, options: nil)?.first as? UIView else {
|
||||
return nil
|
||||
}
|
||||
|
||||
contentView.translatesAutoresizingMaskIntoConstraints = false
|
||||
addSubview(contentView)
|
||||
|
||||
return contentView
|
||||
}
|
||||
|
||||
func fromNib() -> UIView? {
|
||||
guard let contentView = fromNibWithoutConstraints() else { return nil }
|
||||
|
||||
let bottomConstraint = NSLayoutConstraint(
|
||||
item: contentView,
|
||||
attribute: NSLayoutConstraint.Attribute.bottom,
|
||||
relatedBy: NSLayoutConstraint.Relation.equal,
|
||||
toItem: self,
|
||||
attribute: NSLayoutConstraint.Attribute.bottom,
|
||||
multiplier: 1,
|
||||
constant: 0
|
||||
)
|
||||
|
||||
let trailingConstraint = NSLayoutConstraint(
|
||||
item: contentView,
|
||||
attribute: NSLayoutConstraint.Attribute.trailing,
|
||||
relatedBy: NSLayoutConstraint.Relation.equal,
|
||||
toItem: self,
|
||||
attribute: NSLayoutConstraint.Attribute.trailing,
|
||||
multiplier: 1,
|
||||
constant: 0
|
||||
)
|
||||
|
||||
let topConstraint = NSLayoutConstraint(
|
||||
item: contentView,
|
||||
attribute: NSLayoutConstraint.Attribute.top,
|
||||
relatedBy: NSLayoutConstraint.Relation.equal,
|
||||
toItem: self,
|
||||
attribute: NSLayoutConstraint.Attribute.top,
|
||||
multiplier: 1,
|
||||
constant: 0
|
||||
)
|
||||
|
||||
let leadingConstraint = NSLayoutConstraint(
|
||||
item: contentView,
|
||||
attribute: NSLayoutConstraint.Attribute.leading,
|
||||
relatedBy: NSLayoutConstraint.Relation.equal,
|
||||
toItem: self,
|
||||
attribute: NSLayoutConstraint.Attribute.leading,
|
||||
multiplier: 1,
|
||||
constant: 0
|
||||
)
|
||||
|
||||
addConstraints([bottomConstraint, trailingConstraint, topConstraint, leadingConstraint])
|
||||
|
||||
return contentView
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIColor {
|
||||
var redValue: CGFloat{ return CIColor(color: self).red }
|
||||
var greenValue: CGFloat{ return CIColor(color: self).green }
|
||||
var blueValue: CGFloat{ return CIColor(color: self).blue }
|
||||
var alphaValue: CGFloat{ return CIColor(color: self).alpha }
|
||||
}
|
||||
|
||||
class Colors {
|
||||
|
||||
class func rgba( _ red: CGFloat, _ green: CGFloat, _ blue: CGFloat, _ alpha: CGFloat) -> UIColor {
|
||||
return UIColor(red: red / 255, green: green / 255, blue: blue / 255, alpha: alpha)
|
||||
}
|
||||
|
||||
class func rgb( _ red: CGFloat, _ green: CGFloat, _ blue: CGFloat) -> UIColor {
|
||||
return rgba(red, green, blue, 1)
|
||||
}
|
||||
|
||||
class func grayLevel(_ gray: CGFloat) -> UIColor {
|
||||
return rgb(gray * 255, gray * 255, gray * 255)
|
||||
}
|
||||
|
||||
class func blackAlpha(_ alpha: CGFloat) -> UIColor {
|
||||
return rgba(0, 0, 0, alpha)
|
||||
}
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
static public let lightGray = blackAlpha(0.1)
|
||||
static public let slightlyDark = blackAlpha(0.3)
|
||||
static public let halfBlack = blackAlpha(0.5)
|
||||
|
||||
static public let black = grayLevel(0) // 0 %
|
||||
static public let gray = grayLevel(127) // 49 %
|
||||
static public let lightInactiveGray = grayLevel(178) // 69 %
|
||||
static public let silver = grayLevel(229) // 89 %
|
||||
static public let inactiveGray = grayLevel(246) // 96 %
|
||||
static public let white = grayLevel(255) // 100 %
|
||||
|
||||
static public let transparentGray = rgba(225, 225, 225, 0.3)
|
||||
static public let lightOrange = rgba(255, 105, 0, 0.1)
|
||||
|
||||
static public let red = rgb(255, 59, 48)
|
||||
static public let blue = rgb(44, 174, 233)
|
||||
static public let yellow = rgb(254, 219, 6)
|
||||
static public let orange = rgb(255, 105, 0)
|
||||
static public let purple = rgb(128, 0, 128)
|
||||
static public let gold = rgb(226, 201, 127)
|
||||
static public let beige = rgb(245, 245, 220)
|
||||
static public let brand = rgb(255, 105, 0)
|
||||
static public let approveGreen = rgb(49, 183, 0)
|
||||
static public let darkBlue = rgb(74, 144, 226)
|
||||
static public let semidarkBlue = rgb(0, 107, 202)
|
||||
static public let darkGray = rgb(142, 142, 147)
|
||||
static public let lightYellow = rgb(254, 229, 6)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
//
|
||||
// UIView+Positioning.swift
|
||||
//
|
||||
// Created by Shai Mishali on 1/19/15.
|
||||
// Copyright (c) 2015 Shai Mishali. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public extension UIView {
|
||||
|
||||
// MARK: - Basic Properties
|
||||
|
||||
/// X Axis value of UIView.
|
||||
var x: CGFloat {
|
||||
set { self.frame = CGRect(x: _pixelIntegral(newValue),
|
||||
y: self.y,
|
||||
width: self.width,
|
||||
height: self.height)
|
||||
}
|
||||
get { return self.frame.origin.x }
|
||||
}
|
||||
|
||||
/// Y Axis value of UIView.
|
||||
var y: CGFloat {
|
||||
set { self.frame = CGRect(x: self.x,
|
||||
y: _pixelIntegral(newValue),
|
||||
width: self.width,
|
||||
height: self.height)
|
||||
}
|
||||
get { return self.frame.origin.y }
|
||||
}
|
||||
|
||||
/// Width of view.
|
||||
var width: CGFloat {
|
||||
set { self.frame = CGRect(x: self.x,
|
||||
y: self.y,
|
||||
width: _pixelIntegral(newValue),
|
||||
height: self.height)
|
||||
}
|
||||
get { return self.frame.size.width }
|
||||
}
|
||||
|
||||
/// Height of view.
|
||||
var height: CGFloat {
|
||||
set { self.frame = CGRect(x: self.x,
|
||||
y: self.y,
|
||||
width: self.width,
|
||||
height: _pixelIntegral(newValue))
|
||||
}
|
||||
get { return self.frame.size.height }
|
||||
}
|
||||
|
||||
// MARK: - Origin and Size
|
||||
|
||||
/// View's Origin point.
|
||||
var origin: CGPoint {
|
||||
set { self.frame = CGRect(x: _pixelIntegral(newValue.x),
|
||||
y: _pixelIntegral(newValue.y),
|
||||
width: self.width,
|
||||
height: self.height)
|
||||
}
|
||||
get { return self.frame.origin }
|
||||
}
|
||||
|
||||
/// View's size.
|
||||
var size: CGSize {
|
||||
set { self.frame = CGRect(x: self.x,
|
||||
y: self.y,
|
||||
width: _pixelIntegral(newValue.width),
|
||||
height: _pixelIntegral(newValue.height))
|
||||
}
|
||||
get { return self.frame.size }
|
||||
}
|
||||
|
||||
// MARK: - Extra Properties
|
||||
|
||||
/// View's right side (x + width).
|
||||
var right: CGFloat {
|
||||
set { self.x = newValue - self.width }
|
||||
get { return self.x + self.width }
|
||||
}
|
||||
|
||||
/// View's bottom (y + height).
|
||||
var bottom: CGFloat {
|
||||
set { self.y = newValue - self.height }
|
||||
get { return self.y + self.height }
|
||||
}
|
||||
|
||||
/// View's top (y).
|
||||
var top: CGFloat {
|
||||
set { self.y = newValue }
|
||||
get { return self.y }
|
||||
}
|
||||
|
||||
/// View's left side (x).
|
||||
var left: CGFloat {
|
||||
set { self.x = newValue }
|
||||
get { return self.x }
|
||||
}
|
||||
|
||||
/// View's center X value (center.x).
|
||||
var centerX: CGFloat {
|
||||
set { self.center = CGPoint(x: newValue, y: self.centerY) }
|
||||
get { return self.center.x }
|
||||
}
|
||||
|
||||
/// View's center Y value (center.y).
|
||||
var centerY: CGFloat {
|
||||
set { self.center = CGPoint(x: self.centerX, y: newValue) }
|
||||
get { return self.center.y }
|
||||
}
|
||||
|
||||
/// Last subview on X Axis.
|
||||
var lastSubviewOnX: UIView? {
|
||||
return self.subviews.reduce(UIView(frame: .zero)) {
|
||||
return $1.x > $0.x ? $1 : $0
|
||||
}
|
||||
}
|
||||
|
||||
/// Last subview on Y Axis.
|
||||
var lastSubviewOnY: UIView? {
|
||||
return self.subviews.reduce(UIView(frame: .zero)) {
|
||||
return $1.y > $0.y ? $1 : $0
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Bounds Methods
|
||||
|
||||
/// X value of bounds (bounds.origin.x).
|
||||
var boundsX: CGFloat {
|
||||
set { self.bounds = CGRect(x: _pixelIntegral(newValue),
|
||||
y: self.boundsY,
|
||||
width: self.boundsWidth,
|
||||
height: self.boundsHeight)
|
||||
}
|
||||
get { return self.bounds.origin.x }
|
||||
}
|
||||
|
||||
/// Y value of bounds (bounds.origin.y).
|
||||
var boundsY: CGFloat {
|
||||
set { self.frame = CGRect(x: self.boundsX,
|
||||
y: _pixelIntegral(newValue),
|
||||
width: self.boundsWidth,
|
||||
height: self.boundsHeight)
|
||||
}
|
||||
get { return self.bounds.origin.y }
|
||||
}
|
||||
|
||||
/// Width of bounds (bounds.size.width).
|
||||
var boundsWidth: CGFloat {
|
||||
set { self.frame = CGRect(x: self.boundsX,
|
||||
y: self.boundsY,
|
||||
width: _pixelIntegral(newValue),
|
||||
height: self.boundsHeight)
|
||||
}
|
||||
get { return self.bounds.size.width }
|
||||
}
|
||||
|
||||
/// Height of bounds (bounds.size.height).
|
||||
var boundsHeight: CGFloat {
|
||||
set { self.frame = CGRect(x: self.boundsX,
|
||||
y: self.boundsY,
|
||||
width: self.boundsWidth,
|
||||
height: _pixelIntegral(newValue))
|
||||
}
|
||||
get { return self.bounds.size.height }
|
||||
}
|
||||
|
||||
// MARK: - Useful Methods
|
||||
|
||||
/// Center view to it's parent view.
|
||||
// func centerToParent() {
|
||||
// guard let superview = self.superview else { return }
|
||||
//
|
||||
// switch UIApplication.shared.statusBarOrientation {
|
||||
// case .landscapeLeft, .landscapeRight:
|
||||
// self.origin = CGPoint(x: (superview.height / 2) - (self.width / 2),
|
||||
// y: (superview.width / 2) - (self.height / 2))
|
||||
// case .portrait, .portraitUpsideDown:
|
||||
// self.origin = CGPoint(x: (superview.width / 2) - (self.width / 2),
|
||||
// y: (superview.height / 2) - (self.height / 2))
|
||||
// case .unknown:
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
|
||||
// MARK: - Private Methods
|
||||
fileprivate func _pixelIntegral(_ pointValue: CGFloat) -> CGFloat {
|
||||
let scale = UIScreen.main.scale
|
||||
return (round(pointValue * scale) / scale)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,273 @@
|
||||
//
|
||||
// LocalizationManager.swift
|
||||
// KeyGroupFramework
|
||||
//
|
||||
// Created by Nikita Bondar on 22/11/2018.
|
||||
// Copyright © 2018 KeyGroup. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension Notification.Name {
|
||||
public static let kGTNotificationLanguageChanged = Notification.Name("kGTNotificationLanguageChanged")
|
||||
}
|
||||
|
||||
open class LocalizationManager {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
public private(set) static var locale: Locale = .current
|
||||
public static var availableLocales: [String] = ["en"]
|
||||
|
||||
private static var languageCode: String = ""
|
||||
private static var regionCode: String = ""
|
||||
private static var languageBundle: Bundle?
|
||||
private static var englishLanguageBundle = languageBundle(withCode: "en", andType: "lproj")
|
||||
private static var nakedLocalizationEnabled: Bool = false
|
||||
|
||||
// MARK: - Static part
|
||||
|
||||
public static func setNakedLocalization(to value: Bool) {
|
||||
nakedLocalizationEnabled = value
|
||||
NotificationCenter.default.post(name: .kGTNotificationLanguageChanged, object: nil)
|
||||
}
|
||||
|
||||
public static func format(key: String, values: [String]) -> String {
|
||||
if !nakedLocalizationEnabled {
|
||||
let key = _L(key)
|
||||
let formatCounter = key.components(separatedBy: "%@").count - 1
|
||||
if formatCounter != values.count {
|
||||
return "FORMAT ERROR: \(key) -\(values)"
|
||||
}
|
||||
|
||||
let args: [CVarArg] = values
|
||||
let formattedString = withVaList(args) { NSString(format: key, arguments: $0) } as String
|
||||
|
||||
return formattedString
|
||||
} else {
|
||||
return key
|
||||
}
|
||||
}
|
||||
|
||||
public static func localizedString(_ key: String) -> String {
|
||||
initLanguageCode()
|
||||
if !nakedLocalizationEnabled {
|
||||
let langCode = Locale.current.languageCode ?? "en"
|
||||
|
||||
// languageBundle = languageBundle(withCode: languageCode, andType: "lproj")
|
||||
languageBundle = languageBundle(withCode: langCode, andType: "lproj")
|
||||
|
||||
var val = languageBundle?.localizedString(forKey: key, value: key, table: nil)
|
||||
val = val?.replacingOccurrences(of: "%s", with: "%@")
|
||||
|
||||
if val == key {
|
||||
guard let englishString = englishLanguageBundle?.localizedString(forKey: key,
|
||||
value: key,
|
||||
table: nil) else { return key }
|
||||
return englishString.replacingOccurrences(of: "%s", with: "%@")
|
||||
}
|
||||
|
||||
return val ?? key
|
||||
} else {
|
||||
return key
|
||||
}
|
||||
}
|
||||
|
||||
public static func localizedTitleForCurrency(isoCode: String?) -> String {
|
||||
if let isoCode = isoCode {
|
||||
return self.currentLocale().displayName(forKey: .currencyCode, value: isoCode) ?? ""
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
public static func localizedString(forReplacedKey key: String) -> String {
|
||||
var replaced = localizedString(key)
|
||||
replaced = replaced.replacingOccurrences(of: "%s", with: "%@")
|
||||
return replaced
|
||||
}
|
||||
|
||||
public static func localizedString(forCount count: Float, key: String) -> String {
|
||||
initLanguageCode()
|
||||
|
||||
if !nakedLocalizationEnabled {
|
||||
let fewKey = localizedString(key.appending("_FEW"))
|
||||
let manyKey = localizedString(key.appending("S"))
|
||||
let singleKey = localizedString(key)
|
||||
|
||||
let countInt = Int(count)
|
||||
|
||||
if languageCode == "ru" {
|
||||
if count < 1 && count > 0 {
|
||||
return fewKey
|
||||
}
|
||||
|
||||
let mod100 = countInt % 100
|
||||
let mod10 = countInt % 10
|
||||
|
||||
switch mod10 {
|
||||
case 1: return mod100 == 11 ? manyKey : singleKey
|
||||
case 2, 3, 4: return mod100 > 10 && mod100 < 20 ? manyKey : fewKey
|
||||
case 5, 6, 7, 8, 9, 0: return manyKey
|
||||
default: return manyKey
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return count <= 1 ? singleKey : manyKey
|
||||
} else {
|
||||
return key
|
||||
}
|
||||
}
|
||||
|
||||
public static func currentLanguageName() -> String {
|
||||
initLanguageCode()
|
||||
return languageName(withCode: languageCode)
|
||||
}
|
||||
|
||||
public static func currentLanguageCode() -> String {
|
||||
initLanguageCode()
|
||||
return languageCode
|
||||
}
|
||||
|
||||
// class func currentCurrencyCode() -> String {
|
||||
// return ""
|
||||
// }
|
||||
|
||||
public static func currentRegionCode() -> String {
|
||||
let locale = Locale.current as NSLocale
|
||||
|
||||
if let country = locale.object(forKey: .countryCode) as? String {
|
||||
return country
|
||||
}
|
||||
|
||||
// writeToLog
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
public static func languageName(withCode code: String) -> String {
|
||||
let locale = NSLocale(localeIdentifier: code)
|
||||
let newCode = languageCode(withLocale: code)
|
||||
let language = locale.displayName(forKey: .identifier, value: newCode)
|
||||
return language ?? ""
|
||||
}
|
||||
|
||||
public static func countryName(withCode code: String) -> String {
|
||||
let locale = self.currentLocale()
|
||||
if #available(iOS 10.0, *) {
|
||||
// let name = locale.localizedString(forCurrencyCode: code)
|
||||
let name = locale.displayName(forKey: .countryCode, value: code)
|
||||
return name ?? ""
|
||||
} else {
|
||||
return ""
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static func currentLocale() -> NSLocale {
|
||||
initLanguageCode()
|
||||
let locale = NSLocale(localeIdentifier: languageCode)
|
||||
return locale
|
||||
}
|
||||
|
||||
public static func setCurrentLocale(code: String) {
|
||||
let code = code.lowercased()
|
||||
|
||||
guard languageCode != code else { return }
|
||||
guard availableLocales.contains(code) else { return }
|
||||
|
||||
let appleLanguages = code != "sys" ? [code] : []
|
||||
|
||||
UserDefaults.standard.set(appleLanguages, forKey: "AppleLanguages")
|
||||
UserDefaults.standard.synchronize()
|
||||
|
||||
languageCode = code
|
||||
self.regionCode = Locale.current.regionCode ?? ""
|
||||
languageBundle = languageBundle(withCode: languageCode, andType: "lproj")
|
||||
reinstallLocale(languageCode: languageCode, regionCode: regionCode, posix: Date.is12HourFormat)
|
||||
|
||||
NotificationCenter.default.post(name: .kGTNotificationLanguageChanged, object: nil)
|
||||
}
|
||||
|
||||
// MARK: - Private part
|
||||
|
||||
private static func initLanguageCode() {
|
||||
guard languageCode.isEmpty else { return }
|
||||
|
||||
let languageCodeArray = UserDefaults.standard.object(forKey: "AppleLanguages") as? [String] ?? []
|
||||
var code = languageCodeArray.count == 1 ? languageCodeArray[0] : Locale.preferredLanguages[0]
|
||||
|
||||
code = languageCode(withLocale: code)
|
||||
|
||||
if !availableLocales.contains(code) {
|
||||
code = "en"
|
||||
}
|
||||
|
||||
languageCode = code
|
||||
languageBundle = nil
|
||||
}
|
||||
|
||||
private static func languageCode(withLocale locale: String) -> String {
|
||||
var code = locale
|
||||
|
||||
if let range = code.range(of: "-") {
|
||||
let idx = NSRange(range, in: code).location
|
||||
code = String( code[0..<idx] )
|
||||
}
|
||||
|
||||
return code
|
||||
}
|
||||
|
||||
private static func languageBundle(withCode code: String, andType type: String) -> Bundle? {
|
||||
let path = Bundle.main.path(forResource: code, ofType: type)
|
||||
return Bundle(path: path ?? "")
|
||||
}
|
||||
|
||||
private static func reinstallLocale(languageCode: String, regionCode: String, posix: Bool = false) {
|
||||
var identifier = "\(languageCode.lowercased())_\(regionCode.uppercased())"
|
||||
if posix {
|
||||
identifier += "_POSIX"
|
||||
}
|
||||
locale = Locale(identifier: identifier)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension String {
|
||||
|
||||
subscript(value: CountableClosedRange<Int>) -> Substring {
|
||||
return self[index(at: value.lowerBound)...index(at: value.upperBound)]
|
||||
}
|
||||
|
||||
subscript(value: CountableRange<Int>) -> Substring {
|
||||
return self[index(at: value.lowerBound)..<index(at: value.upperBound)]
|
||||
}
|
||||
|
||||
subscript(value: PartialRangeUpTo<Int>) -> Substring {
|
||||
return self[..<index(at: value.upperBound)]
|
||||
}
|
||||
|
||||
subscript(value: PartialRangeThrough<Int>) -> Substring {
|
||||
return self[...index(at: value.upperBound)]
|
||||
}
|
||||
|
||||
subscript(value: PartialRangeFrom<Int>) -> Substring {
|
||||
return self[index(at: value.lowerBound)...]
|
||||
}
|
||||
|
||||
func index(at offset: Int) -> String.Index {
|
||||
return index(startIndex, offsetBy: offset)
|
||||
}
|
||||
}
|
||||
|
||||
extension Date {
|
||||
|
||||
static public var is12HourFormat: Bool {
|
||||
let locale = Locale.current
|
||||
let formatter = DateFormatter.dateFormat(fromTemplate: "j", options: 0, locale: locale)
|
||||
|
||||
return formatter?.contains("a") ?? false
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// LocalizeFuncs.swift
|
||||
// KeyGroupFramework
|
||||
//
|
||||
// Created by Nikita Bondar on 22/11/2018.
|
||||
// Copyright © 2018 KeyGroup. All rights reserved.
|
||||
//
|
||||
|
||||
public func _L(_ key: String) -> String {
|
||||
return LocalizationManager.localizedString(key)
|
||||
}
|
||||
|
||||
public func _LF(_ key: String, _ values: String...) -> String {
|
||||
return LocalizationManager.format(key: key, values: values)
|
||||
}
|
||||
|
||||
public func _LC(_ key: String, _ count: Int) -> String {
|
||||
return _LC(key, Float(count))
|
||||
}
|
||||
|
||||
public func _LC(_ key: String, _ count: Float) -> String {
|
||||
return LocalizationManager.localizedString(forCount: count, key: key)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
|
||||
|
||||
"NSLocationWhenInUseUsageDescription" = "Your current location will be displayed on the map and used for directions, nearby search results, and estimated travel times.";
|
||||
|
||||
"NSLocationAlwaysUsageDescription" = "Your current location will be displayed on the map and used for directions, nearby search results, and estimated travel times.";
|
||||
|
||||
"NSLocationAlwaysAndWhenInUseUsageDescription" = "Your current location will be displayed on the map and used for directions, nearby search results, and estimated travel times.";
|
||||
|
||||
"NSLocationUsageDescription" = "Your current location will be displayed on the map and used for directions, nearby search results, and estimated travel times.";
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
|
||||
"LNG_MAPS_SECTION_SEE_ALL" = "See All";
|
||||
"LNG_MAPS_SECTION_CLEAR" = "Clear";
|
||||
|
||||
"LNG_MAPS_RECENT_SEARCH" = "Recent Searches";
|
||||
"LNG_MAPS_RECENT_CITY" = "Moscow";
|
||||
|
||||
"LNG_MAPS_SECTION_FAVORITES" = "Favorites";
|
||||
"LNG_MAPS_SECTION_COLLECTIONS" = "Collections";
|
||||
"LNG_MAPS_SECTION_RECENTLY_VIEWED" = "Recently Viewed";
|
||||
|
||||
"LNG_MAPS_NEARBY_SEARCH" = "Search Nearby";
|
||||
"LNG_MAPS_NEARBY_RESTAURANTS" = "Restaurants";
|
||||
"LNG_MAPS_NEARBY_FOOD_DELIVERY" = "Food Delivery";
|
||||
"LNG_MAPS_NEARBY_GROCERIES" = "Groceries";
|
||||
"LNG_MAPS_NEARBY_GAS_STATION" = "Gas Station";
|
||||
"LNG_MAPS_NEARBY_PHARMACIES" = "Pharmacies";
|
||||
"LNG_MAPS_NEARBY_HOSPITALS" = "Hospitals";
|
||||
"LNG_MAPS_NEARBY_URGENT_CARE" = "Urgent Care";
|
||||
"LNG_MAPS_NEARBY_SUBWAY" = "Subway";
|
||||
"LNG_MAPS_NEARBY_TRAIN_STATION" = "Train Station";
|
||||
"LNG_MAPS_NEARBY_SHOPPING_CENTERS" = "Shopping Centers";
|
||||
|
||||
"LNG_MAPS_NEW_COLLECTION" = "New Collection...";
|
||||
"LNG_MAPS_SEARCH_PLACE_ADDRESS" = "Search for a place or address";
|
||||
|
||||
"LNG_MAPS_MARKED_LOCATION" = "Marked Location";
|
||||
"LNG_MAPS_DIRECTIONS_MY_LOCATION" = "Directions from My Location";
|
||||
|
||||
"LNG_MAPS_KM" = "km";
|
||||
"LNG_MAPS_TO" = "to";
|
||||
"LNG_MAPS_MIN" = "min";
|
||||
|
||||
"LNG_MAPS_COUNTRY" = "Country";
|
||||
"LNG_MAPS_ADDRESS" = "Address";
|
||||
"LNG_MAPS_STREET" = "Street";
|
||||
"LNG_MAPS_CITY" = "City";
|
||||
"LNG_MAPS_HOME" = "Home";
|
||||
"LNG_MAPS_ADD" = "Add";
|
||||
"LNG_MAPS_SCORE" = "Score";
|
||||
"LNG_MAPS_WORK" = "Work";
|
||||
"LNG_MAPS_REMOVE" = "Remove";
|
||||
"LNG_MAPS_SHARE" = "Share";
|
||||
|
||||
|
||||
"LNG_MAPS_LOCATION_DIRECTIONS" = "Directions";
|
||||
"LNG_MAPS_LOCATION_EDIT" = "Edit Location";
|
||||
|
||||
"LNG_MAPS_LOCATION_LATITUDE" = "Latitude";
|
||||
"LNG_MAPS_LOCATION_LONGITUDE" = "Longitude";
|
||||
|
||||
"LNG_MAPS_LOCATION_ADD_TO_FAVORITES" = "Add to Favorites";
|
||||
"LNG_MAPS_LOCATION_CREATE_NEW_CONTACT" = "Create New Contact";
|
||||
"LNG_MAPS_LOCATION_ADD_TO_EXISTING_CONTACT" = "Add to Existing Contact";
|
||||
"LNG_MAPS_LOCATION_ADD_A_MISSING_PLACE" = "Add a Missing Place";
|
||||
|
||||
|
||||
|
||||
"LNG_MAPS_HR" = "hr";
|
||||
"LNG_MAPS_WHERE" = "То";
|
||||
"LNG_MAPS_FROM" = "From";
|
||||
"LNG_MAPS_MY_LOCATION" = "My Location";
|
||||
|
||||
"LNG_MAPS_GO" = "GO";
|
||||
"LNG_MAPS_SECTION_DRIVING_OPTIONS" = "Driving Options";
|
||||
"LNG_MAPS_SECTION_REPORT_AN_ISSUE" = "Report an Issue";
|
||||
|
||||
"LNG_MAPS_DRIVE" = "Drive";
|
||||
"LNG_MAPS_WALK" = "Walk";
|
||||
"LNG_MAPS_TRANSIT" = "Transit";
|
||||
"LNG_MAPS_RIDE" = "Ride";
|
||||
|
||||
"LNG_MAPS_LOADING" = "Loading...";
|
||||
|
||||
"LNG_MAPS_MENU_MAPS_SETTINGS" = "Maps Settings";
|
||||
"LNG_MAPS_MENU_MAP" = "Map";
|
||||
"LNG_MAPS_MENU_SATELLITE" = "Satellite";
|
||||
"LNG_MAPS_MENU_TRAFFIC" = "Traffic";
|
||||
"LNG_MAPS_SECTION_MARK_MY_LOCATION" = "Mark My Location";
|
||||
|
||||
"LNG_ROUTE_FASTEST" = "Fastest route";
|
||||
"LNG_ROUTE_SIMPLEST" = "Simplest route";
|
||||
|
||||
"LNG_ROUTE_UNKNOWN" = "unknown";
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
"NSLocationWhenInUseUsageDescription" = "Ваша текущая геопозиция будет отображена на карте и использована для предоставления маршрутов, поиска мест рядом и расчета приблизительного времени в пути.";
|
||||
|
||||
"NSLocationAlwaysUsageDescription" = "Ваша текущая геопозиция будет отображена на карте и использована для предоставления маршрутов, поиска мест рядом и расчета приблизительного времени в пути.";
|
||||
|
||||
"NSLocationAlwaysAndWhenInUseUsageDescription" = "Ваша текущая геопозиция будет отображена на карте и использована для предоставления маршрутов, поиска мест рядом и расчета приблизительного времени в пути.";
|
||||
|
||||
"NSLocationUsageDescription" = "Ваша текущая геопозиция будет отображена на карте и использована для предоставления маршрутов, поиска мест рядом и расчета приблизительного времени в пути.";
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
|
||||
"LNG_MAPS_SECTION_SEE_ALL" = "См. все";
|
||||
"LNG_MAPS_SECTION_CLEAR" = "Очистить";
|
||||
|
||||
"LNG_MAPS_RECENT_SEARCH" = "Недавние поиски";
|
||||
"LNG_MAPS_RECENT_CITY" = "Москва";
|
||||
|
||||
"LNG_MAPS_SECTION_FAVORITES" = "Избранное";
|
||||
"LNG_MAPS_SECTION_COLLECTIONS" = "Коллекции";
|
||||
"LNG_MAPS_SECTION_RECENTLY_VIEWED" = "Недавно просмотренные";
|
||||
|
||||
"LNG_MAPS_NEARBY_SEARCH" = "Поиск рядом";
|
||||
"LNG_MAPS_NEARBY_RESTAURANTS" = "Рестораны";
|
||||
"LNG_MAPS_NEARBY_FOOD_DELIVERY" = "Доставка еды";
|
||||
"LNG_MAPS_NEARBY_GROCERIES" = "Продукты";
|
||||
"LNG_MAPS_NEARBY_GAS_STATION" = "АЗС";
|
||||
"LNG_MAPS_NEARBY_PHARMACIES" = "Аптека";
|
||||
"LNG_MAPS_NEARBY_HOSPITALS" = "Больницы";
|
||||
"LNG_MAPS_NEARBY_URGENT_CARE" = "Пункт скорой помощи";
|
||||
"LNG_MAPS_NEARBY_SUBWAY" = "Метро";
|
||||
"LNG_MAPS_NEARBY_TRAIN_STATION" = "Ж/д станции";
|
||||
"LNG_MAPS_NEARBY_SHOPPING_CENTERS" = "Торговые центры";
|
||||
|
||||
"LNG_MAPS_NEW_COLLECTION" = "Новая коллекция...";
|
||||
"LNG_MAPS_SEARCH_PLACE_ADDRESS" = "Поиск места или адреса";
|
||||
|
||||
"LNG_MAPS_MARKED_LOCATION" = "Отмеченная геопозиция";
|
||||
"LNG_MAPS_DIRECTIONS_MY_LOCATION" = "Маршруты из моей геопозиции";
|
||||
|
||||
"LNG_MAPS_KM" = "км";
|
||||
"LNG_MAPS_TO" = "в";
|
||||
"LNG_MAPS_MIN" = "мин";
|
||||
|
||||
"LNG_MAPS_COUNTRY" = "Страна";
|
||||
"LNG_MAPS_ADDRESS" = "Адрес";
|
||||
"LNG_MAPS_STREET" = "Улица";
|
||||
"LNG_MAPS_CITY" = "Город";
|
||||
"LNG_MAPS_HOME" = "Дом";
|
||||
"LNG_MAPS_ADD" = "Добавить";
|
||||
"LNG_MAPS_SCORE" = "Магазин";
|
||||
"LNG_MAPS_WORK" = "Работа";
|
||||
"LNG_MAPS_REMOVE" = "Удалить";
|
||||
"LNG_MAPS_SHARE" = "Поделиться";
|
||||
|
||||
|
||||
"LNG_MAPS_LOCATION_DIRECTIONS" = "Маршруты";
|
||||
"LNG_MAPS_LOCATION_EDIT" = "Изменить геопозицию";
|
||||
|
||||
"LNG_MAPS_LOCATION_LATITUDE" = "Широта";
|
||||
"LNG_MAPS_LOCATION_LONGITUDE" = "Долгота";
|
||||
|
||||
"LNG_MAPS_LOCATION_ADD_TO_FAVORITES" = "Добавить в Избранное";
|
||||
"LNG_MAPS_LOCATION_CREATE_NEW_CONTACT" = "Создать контакт";
|
||||
"LNG_MAPS_LOCATION_ADD_TO_EXISTING_CONTACT" = "Добавить к контакту";
|
||||
"LNG_MAPS_LOCATION_ADD_A_MISSING_PLACE" = "Добавить отсутствующее место";
|
||||
|
||||
|
||||
|
||||
"LNG_MAPS_HR" = "ч";
|
||||
"LNG_MAPS_WHERE" = "Куда:";
|
||||
"LNG_MAPS_FROM" = "Откуда:";
|
||||
"LNG_MAPS_MY_LOCATION" = "Моя геолокация";
|
||||
|
||||
"LNG_MAPS_GO" = "Начать";
|
||||
"LNG_MAPS_SECTION_DRIVING_OPTIONS" = "Параметры для автомаршрута";
|
||||
"LNG_MAPS_SECTION_REPORT_AN_ISSUE" = "Сообщить о проблеме";
|
||||
|
||||
"LNG_MAPS_DRIVE" = "Автомобиль";
|
||||
"LNG_MAPS_WALK" = "Пешком";
|
||||
"LNG_MAPS_TRANSIT" = "Транспорт";
|
||||
"LNG_MAPS_RIDE" = "Поездка";
|
||||
|
||||
"LNG_MAPS_LOADING" = "Загрузка...";
|
||||
|
||||
"LNG_MAPS_MENU_MAPS_SETTINGS" = "Настройки Карт";
|
||||
"LNG_MAPS_MENU_MAP" = "Карта";
|
||||
"LNG_MAPS_MENU_SATELLITE" = "Спутник";
|
||||
"LNG_MAPS_MENU_TRAFFIC" = "Пробки";
|
||||
"LNG_MAPS_SECTION_MARK_MY_LOCATION" = "Отметить мою геопозицию";
|
||||
|
||||
"LNG_ROUTE_FASTEST" = "Самый быстрый";
|
||||
"LNG_ROUTE_SIMPLEST" = "Самый простой маршрут";
|
||||
|
||||
"LNG_ROUTE_UNKNOWN" = "неизвестно";
|
||||
|
||||
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
//
|
||||
// LocationContainerController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 04/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class LocationContainerController: ContainerController, ContainerControllerDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var locationDelegate: LocationContainerControllerDelegate?
|
||||
|
||||
var tableView: TableAdapterView!
|
||||
var items: [TableAdapterItem] = []
|
||||
|
||||
var darkStyle: Bool = false
|
||||
|
||||
var header: HeaderDetailsView!
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(addTo controller: UIViewController, darkStyle: Bool) {
|
||||
super.init(addTo: controller,
|
||||
layout: MapsMainContainerLayout())
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
self.delegate = self
|
||||
|
||||
loadItems()
|
||||
updateTableView()
|
||||
updateContainerView()
|
||||
updateHeaderView()
|
||||
|
||||
add(scrollView: tableView)
|
||||
add(headerView: header)
|
||||
}
|
||||
|
||||
// MARK: - Delegate
|
||||
|
||||
func containerControllerMove(_ controller: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
locationDelegate?.locationContainerController(move: self, position: position, type: type, animation: animation)
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateContainerView() {
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
view.cornerRadius = 12
|
||||
view.addShadow()
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateHeaderView() {
|
||||
|
||||
header = HeaderDetailsView()
|
||||
header.height = 60
|
||||
header.titleLabel.text = _L("LNG_MAPS_MARKED_LOCATION")
|
||||
header.subtitle.text = "27 \(_L("LNG_MAPS_KM"))"
|
||||
header.add(darkStyle: darkStyle)
|
||||
header.buttonCloseClickCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.remove(completion: { [weak self] in
|
||||
guard let __self = self else { return }
|
||||
|
||||
_self.locationDelegate?.locationContainerController(closeComplection: __self)
|
||||
})
|
||||
_self.locationDelegate?.locationContainerController(close: _self)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update DarkStyle
|
||||
|
||||
func update(darkStyle: Bool) {
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
header.add(darkStyle: darkStyle)
|
||||
|
||||
loadItems()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
//MARK: - Update TableView
|
||||
|
||||
func updateTableView() {
|
||||
|
||||
tableView = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 18))
|
||||
tableView.set(items: items, animated: true)
|
||||
|
||||
tableView.didScrollCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.header.separatorView?.alpha = (_self.tableView.contentOffset.y <= 0) ? 0.0 : 1.0
|
||||
}
|
||||
tableView.separatorColor = Colors.rgba(128, 128, 128, 0.6)
|
||||
}
|
||||
|
||||
func loadItems() {
|
||||
|
||||
items = []
|
||||
|
||||
|
||||
|
||||
items.append( LocationButtonCellItem(title: _L("LNG_MAPS_LOCATION_DIRECTIONS"),
|
||||
subtitle: "25 \(_L("LNG_MAPS_MIN")) drive",
|
||||
type: .blue, clickCallback: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.presentRoute()
|
||||
}) )
|
||||
items.append( LocationButtonCellItem(title: _L("LNG_MAPS_LOCATION_EDIT"), type: .gray) )
|
||||
|
||||
items.append( LocationAddressCellItem(darkStyle: darkStyle) )
|
||||
items.append( LocationCollectionsButtonCellItem() )
|
||||
items.append( LocationCoordinateCellItem(darkStyle: darkStyle) )
|
||||
|
||||
items.append( LocationTextCellItem(title: _L("LNG_MAPS_LOCATION_ADD_TO_FAVORITES"), image: UIImage(systemName: "star.fill")) )
|
||||
items.append( LocationTextCellItem(title: _L("LNG_MAPS_LOCATION_CREATE_NEW_CONTACT"), image: UIImage(systemName: "person.crop.circle")) )
|
||||
items.append( LocationTextCellItem(title: _L("LNG_MAPS_LOCATION_ADD_TO_EXISTING_CONTACT"), image: UIImage(systemName: "person.crop.circle.badge.plus")) )
|
||||
items.append( LocationTextCellItem(title: _L("LNG_MAPS_LOCATION_ADD_A_MISSING_PLACE"), image: UIImage(systemName: "plus")) )
|
||||
|
||||
}
|
||||
|
||||
//MARK: - Show Route
|
||||
|
||||
func presentRoute() {
|
||||
locationDelegate?.locationContainerController(showRoute: self)
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// LocationContainerControllerDelegate.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 26/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
protocol LocationContainerControllerDelegate {
|
||||
|
||||
func locationContainerController(showRoute locationContainerController: LocationContainerController)
|
||||
|
||||
func locationContainerController(close locationContainerController: LocationContainerController)
|
||||
|
||||
func locationContainerController(closeComplection locationContainerController: LocationContainerController)
|
||||
|
||||
func locationContainerController(move locationContainerController: LocationContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool)
|
||||
}
|
||||
+206
@@ -0,0 +1,206 @@
|
||||
//
|
||||
// MapsContainerController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 04/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MapsContainerController: ContainerController, ContainerControllerDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var mapsDelegate: MapsContainerControllerDelegate?
|
||||
|
||||
var tableView: TableAdapterView!
|
||||
var items: [TableAdapterItem] = []
|
||||
|
||||
var darkStyle: Bool = false
|
||||
var searchSelected: Bool = false
|
||||
|
||||
var headerSearchBarView: HeaderSearchBarView!
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(addTo controller: UIViewController, darkStyle: Bool) {
|
||||
super.init(addTo: controller,
|
||||
layout: MapsMainContainerLayout())
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
self.delegate = self
|
||||
|
||||
loadItems()
|
||||
updateTableView()
|
||||
updateContainerView()
|
||||
updateHeaderView()
|
||||
|
||||
add(scrollView: tableView)
|
||||
add(headerView: headerSearchBarView)
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Delegate
|
||||
|
||||
func containerControllerMove(_ controller: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
|
||||
mapsDelegate?.mapsContainerController(move: self, position: position, type: type, animation: animation)
|
||||
|
||||
if animation, type != .top {
|
||||
headerSearchBarView.searchBar.setShowsCancelButton(false, animated: true)
|
||||
updateTableView(searchSelected: false)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateContainerView() {
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
view.cornerRadius = 12
|
||||
view.addShadow()
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateHeaderView() {
|
||||
|
||||
headerSearchBarView = HeaderSearchBarView()
|
||||
headerSearchBarView.searchBarBeginEditingCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.updateTableView(searchSelected: true)
|
||||
_self.move(type: .top)
|
||||
}
|
||||
headerSearchBarView.searchBarCancelButtonClickedCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.controller?.view.endEditing(true)
|
||||
_self.updateTableView(searchSelected: false)
|
||||
_self.move(type: .middle)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update DarkStyle
|
||||
|
||||
func update(darkStyle: Bool) {
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
headerSearchBarView.set(darkStyle: darkStyle)
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
|
||||
|
||||
loadItems()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
func updateTableView(searchSelected: Bool) {
|
||||
if self.searchSelected == searchSelected { return }
|
||||
|
||||
self.searchSelected = searchSelected
|
||||
|
||||
loadItems()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
//MARK: - Update TableView
|
||||
|
||||
func updateTableView() {
|
||||
|
||||
tableView = TableAdapterView()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
tableView.selectIndexCallback = { [weak self] (index: Int) -> Void in
|
||||
guard let _self = self, _self.items[index] is MapsLocationCellItem else { return }
|
||||
|
||||
_self.showLocationDetails()
|
||||
}
|
||||
tableView.didScrollCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.controller?.view.endEditing(true)
|
||||
// let state = _self.tableView.panGestureRecognizer.state
|
||||
// print("\(state)")
|
||||
//
|
||||
// switch _self.tableView.panGestureRecognizer.state {
|
||||
// case .began:
|
||||
// default: break
|
||||
// }
|
||||
|
||||
_self.headerSearchBarView.separatorView?.alpha = (_self.tableView.contentOffset.y <= 0) ? 0.0 : 1.0
|
||||
}
|
||||
tableView.separatorColor = Colors.rgba(128, 128, 128, 0.6)
|
||||
}
|
||||
|
||||
func loadItems() {
|
||||
|
||||
items = []
|
||||
|
||||
if searchSelected {
|
||||
|
||||
let orange: UIColor = Colors.rgb(248, 149, 64)
|
||||
let yellow: UIColor = Colors.rgb(255, 179, 0)
|
||||
let blue: UIColor = Colors.rgb(29, 160, 255)
|
||||
let red: UIColor = Colors.rgb(255, 93, 90)
|
||||
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_RECENT_SEARCH"), textButton: _L("LNG_MAPS_SECTION_SEE_ALL")) )
|
||||
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_RECENT_CITY"), color: .clear, separator: false) )
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_NEARBY_SEARCH"), textButton: "") )
|
||||
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_RESTAURANTS"), color: orange) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_FOOD_DELIVERY"), color: orange) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_GROCERIES"), color: yellow) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_GAS_STATION"), color: blue) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_PHARMACIES"), color: red) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_HOSPITALS"), color: red) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_URGENT_CARE"), color: red) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_SUBWAY"), color: blue) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_TRAIN_STATION"), color: blue) )
|
||||
items.append( MapsSearchCellItem(darkStyle: darkStyle, title: _L("LNG_MAPS_NEARBY_SHOPPING_CENTERS"), color: yellow) )
|
||||
|
||||
} else {
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_FAVORITES")) )
|
||||
items.append( MapsFavoritesCellItem(darkStyle: darkStyle, clickCallback: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.showLocationDetails()
|
||||
}) )
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_COLLECTIONS")) )
|
||||
items.append( MapsCollectionsCellItem() )
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_RECENTLY_VIEWED")) )
|
||||
|
||||
for index in 1...7 {
|
||||
let title = String(format: "%@ %d", _L("LNG_MAPS_MARKED_LOCATION"), index)
|
||||
let subtitle = String(format: "%@, %d/2, %@", _L("LNG_MAPS_STREET"), index, _L("LNG_MAPS_CITY"))
|
||||
items.append( MapsLocationCellItem(title: title, subtitle: subtitle, colorType: .red, darkStyle: darkStyle) )
|
||||
}
|
||||
for index in 8...11 {
|
||||
let title = String(format: "%@ %d", _L("LNG_MAPS_MARKED_LOCATION"), index)
|
||||
let subtitle = _L("LNG_MAPS_DIRECTIONS_MY_LOCATION")
|
||||
items.append( MapsLocationCellItem(title: title, subtitle: subtitle, colorType: .black, darkStyle: darkStyle) )
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Show Location-Details
|
||||
|
||||
func showLocationDetails() {
|
||||
|
||||
mapsDelegate?.mapsContainerController(showLocationDetails: self)
|
||||
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// MapsContainerControllerDelegate.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 25/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
protocol MapsContainerControllerDelegate {
|
||||
|
||||
func mapsContainerController(showLocationDetails mapsContainerController: MapsContainerController)
|
||||
|
||||
func mapsContainerController(move mapsContainerController: MapsContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool)
|
||||
|
||||
}
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
//
|
||||
// LocationContainerController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 04/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MenuContainerController: ContainerController, ContainerControllerDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var menuDelegate: MenuContainerControllerDelegate?
|
||||
|
||||
var tableView: TableAdapterView!
|
||||
var items: [TableAdapterItem] = []
|
||||
var header: MapsMenuHeader!
|
||||
|
||||
var selectedIndex: Int = 0
|
||||
var darkStyle: Bool = false
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(addTo controller: UIViewController, darkStyle: Bool, selectedIndex: Int) {
|
||||
super.init(addTo: controller,
|
||||
layout: MapsMenuContainerLayout())
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
self.selectedIndex = selectedIndex
|
||||
|
||||
self.delegate = self
|
||||
|
||||
loadItems()
|
||||
updateTableView()
|
||||
updateContainerView()
|
||||
updateHeaderView()
|
||||
|
||||
add(scrollView: tableView)
|
||||
add(headerView: header)
|
||||
|
||||
move(type: .top)
|
||||
}
|
||||
|
||||
// MARK: - Delegate
|
||||
|
||||
func containerControllerShadowClick(_ containerController: ContainerController) {
|
||||
closeContainer()
|
||||
}
|
||||
|
||||
func closeContainer() {
|
||||
remove(completion: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
_self.menuDelegate?.menuContainerController(closeComplection: _self)
|
||||
})
|
||||
menuDelegate?.menuContainerController(close: self)
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateContainerView() {
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
view.cornerRadius = 12
|
||||
view.addShadow()
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func updateHeaderView() {
|
||||
|
||||
header = MapsMenuHeader()
|
||||
|
||||
header.set(darkStyle: darkStyle)
|
||||
header.buttonCloseClickCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
_self.closeContainer()
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update TableView
|
||||
|
||||
func updateTableView() {
|
||||
|
||||
tableView = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
tableView.set(items: items, animated: true)
|
||||
tableView.separatorColor = Colors.rgba(128, 128, 128, 0.6)
|
||||
}
|
||||
|
||||
|
||||
func loadItems() {
|
||||
|
||||
items = []
|
||||
|
||||
items.append( MapsMenuSegmentCellItem(selected: selectedIndex, darkStyle: darkStyle, selectIndexCallback: { [weak self] (_ index: Int) in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.selectedIndex = index
|
||||
|
||||
_self.menuDelegate?.menuContainerController(segment: _self, selectedIndex: index)
|
||||
|
||||
_self.darkStyle = (index == 2)
|
||||
|
||||
_self.view.addBlur(darkStyle: _self.darkStyle)
|
||||
_self.header.set(darkStyle: _self.darkStyle)
|
||||
|
||||
_self.loadItems()
|
||||
_self.tableView.set(items: _self.items, animated: true)
|
||||
}) )
|
||||
|
||||
items.append( MapsMenuTextCellItem(title: _L("LNG_MAPS_MENU_TRAFFIC"), switchShow: true, darkStyle: darkStyle, separator: false) )
|
||||
|
||||
items.append( MapsMenuSpaceCellItem() )
|
||||
|
||||
items.append( MapsMenuTextCellItem(title: _L("LNG_MAPS_SECTION_MARK_MY_LOCATION")) )
|
||||
items.append( MapsMenuTextCellItem(title: _L("LNG_MAPS_LOCATION_ADD_A_MISSING_PLACE")) )
|
||||
items.append( MapsMenuTextCellItem(title: _L("LNG_MAPS_SECTION_REPORT_AN_ISSUE"), separator: false) )
|
||||
|
||||
items.append( MapsMenuSpaceCellItem() )
|
||||
// items.append( MapsMenuSpaceCellItem(cellHeight: 100) )
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// MenuContainerControllerDelegate.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 26/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
protocol MenuContainerControllerDelegate {
|
||||
|
||||
func menuContainerController(close menuContainerController: MenuContainerController)
|
||||
|
||||
func menuContainerController(closeComplection menuContainerController: MenuContainerController)
|
||||
|
||||
func menuContainerController(segment menuContainerController: MenuContainerController, selectedIndex: Int)
|
||||
}
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
//
|
||||
// LocationContainerController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 04/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
open class RouteContainerController: ContainerController, ContainerControllerDelegate {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var routeDelegate: RouteContainerControllerDelegate?
|
||||
|
||||
var tableView: TableAdapterView!
|
||||
var items: [TableAdapterItem] = []
|
||||
|
||||
var darkStyle: Bool = false
|
||||
|
||||
var tabbar: HeaderTabBarView!
|
||||
var header: HeaderDetailsView!
|
||||
var tableHeader: TableHeaderSpinerView?
|
||||
var routeLayout: MapsRouteContainerLayout
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(addTo controller: UIViewController, darkStyle: Bool) {
|
||||
|
||||
routeLayout = MapsRouteContainerLayout()
|
||||
|
||||
super.init(addTo: controller,
|
||||
layout: routeLayout)
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
self.delegate = self
|
||||
|
||||
loadTableItems()
|
||||
loadTableView()
|
||||
|
||||
loadContainerView()
|
||||
loadHeaderView()
|
||||
loadTabBarBottom()
|
||||
|
||||
add(scrollView: tableView)
|
||||
add(headerView: header)
|
||||
add(footerView: tabbar)
|
||||
}
|
||||
|
||||
// MARK: - Delegate
|
||||
|
||||
public func containerControllerMove(_ controller: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
routeDelegate?.routeContainerController(move: self, position: position, type: type, animation: animation)
|
||||
|
||||
if let tableHeader = tableHeader {
|
||||
|
||||
if animation {
|
||||
UIView.animate(withDuration: 0.55, animations: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
switch type {
|
||||
case .top: tableHeader.height = (ContainerDevice.height - (_self.layout.positions.top + _self.header.height + _self.tabbar.height))
|
||||
case .middle: tableHeader.height = MapsRouteCellData.height()
|
||||
case .bottom: tableHeader.height = 0.0
|
||||
default: break
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
tableHeader.height = tableView.height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func loadContainerView() {
|
||||
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
view.cornerRadius = 12
|
||||
view.addShadow()
|
||||
}
|
||||
|
||||
//MARK: - Update Container-View
|
||||
|
||||
func loadTabBarBottom() {
|
||||
|
||||
tabbar = HeaderTabBarView()
|
||||
tabbar.height = (49.0 + ContainerDevice.isIphoneXBottom)
|
||||
tabbar.addBlur(darkStyle: darkStyle)
|
||||
|
||||
}
|
||||
|
||||
func loadHeaderView() {
|
||||
|
||||
header = HeaderDetailsView()
|
||||
header.height = 78
|
||||
header.separatorView?.alpha = 1.0
|
||||
header.titleLabel.text = "\(_L("LNG_MAPS_WHERE")) \(_L("LNG_MAPS_MARKED_LOCATION"))"
|
||||
header.subtitle.text = _L("LNG_MAPS_FROM")
|
||||
header.textButton.setTitle(_L("LNG_MAPS_MY_LOCATION"), for: .normal)
|
||||
header.add(darkStyle: darkStyle)
|
||||
header.buttonCloseClickCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
if let tab = _self.tabbar {
|
||||
tab.removeFromSuperview()
|
||||
}
|
||||
_self.remove(completion: { [weak self] in
|
||||
guard let __self = self else { return }
|
||||
_self.routeDelegate?.routeContainerController(closeComplection: __self)
|
||||
})
|
||||
_self.routeDelegate?.routeContainerController(close: _self)
|
||||
}
|
||||
}
|
||||
|
||||
//MARK: - Update DarkStyle
|
||||
|
||||
func update(darkStyle: Bool) {
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
view.addBlur(darkStyle: darkStyle)
|
||||
header.add(darkStyle: darkStyle)
|
||||
tabbar?.addBlur(darkStyle: darkStyle)
|
||||
|
||||
loadTableItems()
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.set(items: items, animated: true)
|
||||
}
|
||||
|
||||
|
||||
//MARK: - Update TableView
|
||||
|
||||
func loadTableView() {
|
||||
|
||||
tableView = TableAdapterView(frame: CGRect(x: 0, y: 0, width: ContainerDevice.width, height: 0), style: .plain)
|
||||
tableView.indicatorStyle = darkStyle ? .white : .default
|
||||
tableView.separatorColor = Colors.rgba(128, 128, 128, 0.6)
|
||||
|
||||
tableHeader = TableHeaderSpinerView()
|
||||
tableHeader?.width = ContainerDevice.width
|
||||
tableHeader?.backgroundColor = .clear
|
||||
tableView.tableHeaderView = tableHeader
|
||||
|
||||
main(delay: 2.5) { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
|
||||
_self.tableView.tableHeaderView = nil
|
||||
_self.tableHeader?.removeFromSuperview()
|
||||
_self.tableHeader = nil
|
||||
|
||||
_self.routeLayout.footerPadding = MapsRouteCellData.height()
|
||||
|
||||
_self.tableView.set(items: _self.items, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
public func main(delay: Double, work: @escaping () -> Void) {
|
||||
let deadline = DispatchTime.now() + delay
|
||||
DispatchQueue.main.asyncAfter(deadline: deadline) {
|
||||
work()
|
||||
}
|
||||
}
|
||||
|
||||
func loadTableItems() {
|
||||
|
||||
items = []
|
||||
|
||||
items.append( MapsRouteCellItem(darkStyle: darkStyle, title: "15 \(_L("LNG_MAPS_MIN"))", subtitle: "24 \(_L("LNG_MAPS_KM")) · \(_L("LNG_MAPS_STREET")) 1234541\n\(_L("LNG_ROUTE_FASTEST"))", selected: true) )
|
||||
items.append( MapsRouteCellItem(darkStyle: darkStyle, title: "40 \(_L("LNG_MAPS_MIN"))", subtitle: "31 \(_L("LNG_MAPS_KM")) · \(_L("LNG_MAPS_STREET")) \(_L("LNG_ROUTE_UNKNOWN"))...\n№ 7029") )
|
||||
items.append( MapsRouteCellItem(darkStyle: darkStyle, title: "45 \(_L("LNG_MAPS_MIN"))", subtitle: "29 \(_L("LNG_MAPS_KM")) · \(_L("LNG_MAPS_STREET")) \(_L("LNG_ROUTE_UNKNOWN"))\n\(_L("LNG_ROUTE_SIMPLEST"))") )
|
||||
items.append( MapsRouteCellItem(darkStyle: darkStyle, title: "45 \(_L("LNG_MAPS_MIN"))", subtitle: "29 \(_L("LNG_MAPS_KM")) · \(_L("LNG_MAPS_STREET")) \(_L("LNG_ROUTE_UNKNOWN"))\n\(_L("LNG_ROUTE_SIMPLEST"))") )
|
||||
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_DRIVING_OPTIONS"), textButton: "") )
|
||||
items.append( MapsSectionCellItem(title: _L("LNG_MAPS_SECTION_REPORT_AN_ISSUE"), textButton: "") )
|
||||
}
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// RouteContainerControllerDelegate.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 26/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
public protocol RouteContainerControllerDelegate {
|
||||
|
||||
func routeContainerController(close routeContainerController: RouteContainerController)
|
||||
|
||||
func routeContainerController(closeComplection routeContainerController: RouteContainerController)
|
||||
|
||||
func routeContainerController(move routeContainerController: RouteContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool)
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// MapsContainerLayout.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 22/05/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MapsContainerLayout: ContainerLayout {
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
startPosition = .hide
|
||||
|
||||
setBackgroundShadow()
|
||||
|
||||
setIPadInsets()
|
||||
|
||||
setLandscapePositions()
|
||||
setLandscapeInsets()
|
||||
}
|
||||
|
||||
private func setBackgroundShadow() {
|
||||
|
||||
backgroundShadowShow = ContainerDevice.isIpad ? false : true
|
||||
landscapeBackgroundShadowShow = false
|
||||
}
|
||||
|
||||
private func setIPadInsets() {
|
||||
|
||||
if ContainerDevice.isIpad {
|
||||
|
||||
let width: CGFloat = 320
|
||||
|
||||
let left: CGFloat = 8
|
||||
let right: CGFloat = (ContainerDevice.screenMin - width)
|
||||
|
||||
insets = ContainerInsets(right: right, left: left)
|
||||
}
|
||||
}
|
||||
|
||||
private func setLandscapePositions() {
|
||||
|
||||
var top: CGFloat = 8
|
||||
if ContainerDevice.isIphoneX { top += 16 }
|
||||
else if ContainerDevice.isIpad { top += ContainerDevice.statusBarHeight }
|
||||
|
||||
var bottom: CGFloat = 70
|
||||
if ContainerDevice.isIphoneX { bottom += ContainerDevice.isIphoneXTop }
|
||||
|
||||
landscapePositions = ContainerPosition(top: top, bottom: bottom)
|
||||
}
|
||||
|
||||
private func setLandscapeInsets() {
|
||||
|
||||
let width: CGFloat = ContainerDevice.isIphoneX ? 320 : 290
|
||||
|
||||
let left: CGFloat = (ContainerDevice.isIphoneX ? 44 : 8)
|
||||
let right: CGFloat = (ContainerDevice.screenMax - width)
|
||||
|
||||
landscapeInsets = ContainerInsets(right: right, left: left)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// MapsMainContainerLayout.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 23/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MapsMainContainerLayout: MapsContainerLayout {
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
var top: CGFloat = 44
|
||||
if ContainerDevice.isIphoneX { top += 12 }
|
||||
|
||||
var bottom: CGFloat = 70
|
||||
if ContainerDevice.isIphoneX { bottom += ContainerDevice.isIphoneXBottom }
|
||||
|
||||
var middle: CGFloat = 262
|
||||
if ContainerDevice.isIphoneX { middle = 325 }
|
||||
else if ContainerDevice.isIphone5 { middle = 192 }
|
||||
|
||||
positions = ContainerPosition(top: top, middle: middle, bottom: bottom)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// MapsMenuContainerLayout.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 23/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MapsMenuContainerLayout: ContainerLayout {
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
var paddingBottom: CGFloat = 410
|
||||
if ContainerDevice.isIphoneX {
|
||||
paddingBottom += 56
|
||||
}
|
||||
|
||||
var top: CGFloat = 0
|
||||
if ContainerDevice.isPortrait, !ContainerDevice.isIpad {
|
||||
top = (ContainerDevice.height - paddingBottom)
|
||||
}
|
||||
|
||||
movingEnabled = false
|
||||
|
||||
positions = ContainerPosition(top: top, bottom: 0.0)
|
||||
|
||||
backgroundShadowShow = true
|
||||
|
||||
landscapeBackgroundShadowShow = true
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// MapsRouteContainerLayout.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 23/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MapsRouteContainerLayout: MapsContainerLayout {
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
|
||||
var top: CGFloat = 44
|
||||
if ContainerDevice.isIphoneX { top += 12 }
|
||||
|
||||
var bottom: CGFloat = 77
|
||||
if ContainerDevice.isIphoneX { bottom += ContainerDevice.isIphoneXBottom }
|
||||
|
||||
let tabbarHeight: CGFloat = 49.0 + ContainerDevice.isIphoneXBottom
|
||||
let headerHeight: CGFloat = 78.0
|
||||
let middle: CGFloat = (headerHeight + tabbarHeight + MapsRouteCellData.height())
|
||||
|
||||
positions = ContainerPosition(top: top, middle: middle, bottom: bottom)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,261 @@
|
||||
//
|
||||
// MapViewController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 19/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MapKit
|
||||
import CoreLocation
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MapViewManager: NSObject {
|
||||
|
||||
// MARK: Map Properties
|
||||
|
||||
var mapView: MKMapView?
|
||||
var compass: MKCompassButton!
|
||||
|
||||
var locationManager: CLLocationManager?
|
||||
|
||||
var selectAnnotation: MKPointAnnotation?
|
||||
var routeOverlay: MKOverlay?
|
||||
var setMoveMyLocationOnce: Bool = false
|
||||
|
||||
// MARK: - Callbacks
|
||||
|
||||
var changeRegionCallback: (() -> ())?
|
||||
var selectPinCallback: (() -> ())?
|
||||
|
||||
// MARK: - Init
|
||||
|
||||
public init(mapView: MKMapView) {
|
||||
super.init()
|
||||
|
||||
mapView.delegate = self
|
||||
self.mapView = mapView
|
||||
|
||||
loadLocation()
|
||||
updateCompass()
|
||||
}
|
||||
|
||||
// MARK: - Location Manager
|
||||
|
||||
func loadLocation() {
|
||||
|
||||
if CLLocationManager.locationServicesEnabled() {
|
||||
locationManager = CLLocationManager()
|
||||
locationManager?.delegate = self
|
||||
locationManager?.desiredAccuracy = kCLLocationAccuracyBest
|
||||
locationManager?.requestAlwaysAuthorization()
|
||||
locationManager?.startUpdatingLocation()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Map Compass
|
||||
|
||||
func updateCompass() {
|
||||
|
||||
mapView?.showsCompass = false
|
||||
|
||||
compass = MKCompassButton(mapView:mapView)
|
||||
compass.x = (ContainerDevice.width - 47)
|
||||
compass.compassVisibility = .adaptive
|
||||
|
||||
mapView?.addSubview(compass)
|
||||
}
|
||||
|
||||
public func closeRoute(showSelectPin: Bool) {
|
||||
|
||||
if let route = routeOverlay {
|
||||
mapView?.removeOverlay(route)
|
||||
}
|
||||
selectPinAnimation(show: showSelectPin)
|
||||
}
|
||||
|
||||
public func selectPinAnimation(show: Bool) {
|
||||
|
||||
if let selectPin = selectAnnotation {
|
||||
if show {
|
||||
mapView?.selectAnnotation(selectPin, animated: true)
|
||||
} else {
|
||||
mapView?.deselectAnnotation(selectPin, animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func addMapPinFrom(longPress: UILongPressGestureRecognizer) {
|
||||
|
||||
guard let mapView = mapView else { return }
|
||||
|
||||
if let anotationMap = selectAnnotation {
|
||||
mapView.removeAnnotations([anotationMap]);
|
||||
}
|
||||
|
||||
let point: CGPoint = longPress.location(in: mapView)
|
||||
let coordinate: CLLocationCoordinate2D = mapView.convert(point, toCoordinateFrom: mapView)
|
||||
|
||||
let annotation = MKPointAnnotation()
|
||||
annotation.coordinate = coordinate
|
||||
mapView.addAnnotation(annotation)
|
||||
|
||||
selectAnnotation = annotation
|
||||
|
||||
mapView.selectAnnotation(annotation, animated: true)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - 🗺 Map Show Route
|
||||
|
||||
public func showRouteOnMapMyLocation() {
|
||||
if let pickupCoord = mapView?.userLocation.location?.coordinate,
|
||||
let destinationCoord = selectAnnotation {
|
||||
|
||||
showRouteOnMap(pickupCoordinate: pickupCoord, destinationCoordinate: destinationCoord.coordinate)
|
||||
}
|
||||
}
|
||||
|
||||
public func showRouteOnMap(pickupCoordinate: CLLocationCoordinate2D, destinationCoordinate: CLLocationCoordinate2D) {
|
||||
|
||||
closeRoute(showSelectPin: false)
|
||||
|
||||
let sourcePlacemark = MKPlacemark(coordinate: pickupCoordinate, addressDictionary: nil)
|
||||
let sourceMapItem = MKMapItem(placemark: sourcePlacemark)
|
||||
|
||||
let destinationPlacemark = MKPlacemark(coordinate: destinationCoordinate, addressDictionary: nil)
|
||||
let destinationMapItem = MKMapItem(placemark: destinationPlacemark)
|
||||
|
||||
let directionRequest = MKDirections.Request()
|
||||
directionRequest.source = sourceMapItem
|
||||
directionRequest.destination = destinationMapItem
|
||||
directionRequest.transportType = .automobile
|
||||
|
||||
|
||||
let directions = MKDirections(request: directionRequest)
|
||||
|
||||
directions.calculate { [weak self] (response, error) -> Void in
|
||||
guard let _self = self else { return }
|
||||
|
||||
guard let response = response else { return }
|
||||
|
||||
let route = response.routes[0]
|
||||
|
||||
_self.routeOverlay = route.polyline
|
||||
|
||||
_self.mapView?.addOverlay((route.polyline), level: MKOverlayLevel.aboveRoads)
|
||||
|
||||
let rect: MKMapRect = route.polyline.boundingMapRect
|
||||
|
||||
let coordReg: MKCoordinateRegion = MKCoordinateRegion(rect)
|
||||
|
||||
let mapButtonWidth: CGFloat = 45
|
||||
|
||||
let padding: CGFloat = 35
|
||||
let bottom: CGFloat = ContainerDevice.isPortrait ? (261 + padding) : padding
|
||||
let left: CGFloat = ContainerDevice.isPortrait ? padding : (261 + padding * 2)
|
||||
let right: CGFloat = (mapButtonWidth + 8 + padding)
|
||||
|
||||
let insets = UIEdgeInsets(top: padding, left: left, bottom: bottom, right: right)
|
||||
|
||||
_self.mapView?.setVisibleRegion(mapRegion: coordReg, edgePadding: insets, animated: true)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - ⚠️ Map-Delegate
|
||||
|
||||
extension MapViewManager: MKMapViewDelegate {
|
||||
|
||||
func mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool) {
|
||||
if !animated {
|
||||
changeRegionCallback?()
|
||||
}
|
||||
}
|
||||
|
||||
func mapView(_ mapView: MKMapView, regionWillChangeAnimated animated: Bool) {
|
||||
if !animated {
|
||||
changeRegionCallback?()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Map Select-Pin
|
||||
|
||||
func mapView(_ mapView: MKMapView, didSelect view: MKAnnotationView) {
|
||||
|
||||
let region = MKCoordinateRegion(center: view.annotation!.coordinate, span: mapView.region.span)
|
||||
mapView.setRegion(region, animated: true)
|
||||
|
||||
selectPinCallback?()
|
||||
|
||||
if let route = routeOverlay {
|
||||
mapView.removeOverlay(route)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Map Route-Color
|
||||
|
||||
func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer {
|
||||
|
||||
let renderer = MKPolylineRenderer(overlay: overlay)
|
||||
|
||||
renderer.strokeColor = Colors.rgb(17, 147, 255)
|
||||
renderer.lineWidth = 8.0
|
||||
|
||||
return renderer
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - ⚠️ Update Location Delegate
|
||||
|
||||
extension MapViewManager: CLLocationManagerDelegate {
|
||||
|
||||
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
|
||||
|
||||
if setMoveMyLocationOnce { return }
|
||||
|
||||
if let location = locations.last {
|
||||
let center = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
|
||||
|
||||
let radius: CLLocationDistance = 3200
|
||||
let region = MKCoordinateRegion(center: center, latitudinalMeters: radius, longitudinalMeters: radius)
|
||||
|
||||
mapView?.setRegion(region, animated: false)
|
||||
|
||||
let annotation = MKPointAnnotation()
|
||||
annotation.coordinate = CLLocationCoordinate2D(latitude: location.coordinate.latitude + 0.01, longitude: location.coordinate.longitude + 0.01)
|
||||
mapView?.addAnnotation(annotation)
|
||||
selectAnnotation = annotation
|
||||
|
||||
setMoveMyLocationOnce = true
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - 🗺 Map Extension
|
||||
|
||||
extension MKCoordinateRegion {
|
||||
var mapRect: MKMapRect {
|
||||
get {
|
||||
let a = MKMapPoint( CLLocationCoordinate2DMake(
|
||||
self.center.latitude + self.span.latitudeDelta / 2,
|
||||
self.center.longitude - self.span.longitudeDelta / 2))
|
||||
|
||||
let b = MKMapPoint( CLLocationCoordinate2DMake(
|
||||
self.center.latitude - self.span.latitudeDelta / 2,
|
||||
self.center.longitude + self.span.longitudeDelta / 2))
|
||||
|
||||
return MKMapRect(x: min(a.x,b.x), y: min(a.y,b.y), width: abs(a.x-b.x), height: abs(a.y-b.y))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension MKMapView {
|
||||
func setVisibleRegion(mapRegion: MKCoordinateRegion, edgePadding insets: UIEdgeInsets, animated animate: Bool) {
|
||||
self.setVisibleMapRect(mapRegion.mapRect, edgePadding: insets , animated: animate)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.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="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Maps View Controller-->
|
||||
<scene sceneID="Rk6-gL-wZG">
|
||||
<objects>
|
||||
<viewController storyboardIdentifier="MapsViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="f2s-jC-2Ov" customClass="MapsViewController" customModule="ContainerController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="kgU-LS-KrK">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" showsUserLocation="YES" translatesAutoresizingMaskIntoConstraints="NO" id="UJh-Fm-jmk">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<gestureRecognizers/>
|
||||
<connections>
|
||||
<outletCollection property="gestureRecognizers" destination="sxv-Tw-fIc" appends="YES" id="CQx-BC-g6G"/>
|
||||
</connections>
|
||||
</mapView>
|
||||
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="KvC-se-dlU">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="20"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="qLU-jw-IXJ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
</view>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="20" id="5UE-cf-AY5"/>
|
||||
</constraints>
|
||||
<blurEffect style="regular"/>
|
||||
</visualEffectView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BF1-Z2-4rJ" customClass="MapsButtons" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="322" y="28" width="45" height="91"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="45" id="ScR-6k-Ysj"/>
|
||||
<constraint firstAttribute="height" constant="91" id="ddV-29-jFA"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cpf-5B-ldg" customClass="MapsWeatherView" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="309" y="342" width="58" height="27"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<gestureRecognizers/>
|
||||
<constraints>
|
||||
<constraint firstItem="UJh-Fm-jmk" firstAttribute="top" secondItem="kgU-LS-KrK" secondAttribute="top" id="0va-s9-Aub"/>
|
||||
<constraint firstItem="UJh-Fm-jmk" firstAttribute="leading" secondItem="kgU-LS-KrK" secondAttribute="leading" id="6pA-L6-gGI"/>
|
||||
<constraint firstAttribute="trailing" secondItem="UJh-Fm-jmk" secondAttribute="trailing" id="7pp-6d-NRv"/>
|
||||
<constraint firstItem="KvC-se-dlU" firstAttribute="leading" secondItem="kgU-LS-KrK" secondAttribute="leading" id="BG7-aK-8Pp"/>
|
||||
<constraint firstItem="KvC-se-dlU" firstAttribute="trailing" secondItem="kgU-LS-KrK" secondAttribute="trailing" id="Eic-Cw-bQD"/>
|
||||
<constraint firstItem="KvC-se-dlU" firstAttribute="top" secondItem="kgU-LS-KrK" secondAttribute="top" id="aqu-Fv-lq0"/>
|
||||
<constraint firstAttribute="trailing" secondItem="BF1-Z2-4rJ" secondAttribute="trailing" constant="8" id="eED-Hs-eow"/>
|
||||
<constraint firstAttribute="bottom" secondItem="UJh-Fm-jmk" secondAttribute="bottom" id="rbR-5f-1BQ"/>
|
||||
<constraint firstItem="BF1-Z2-4rJ" firstAttribute="top" secondItem="kgU-LS-KrK" secondAttribute="top" constant="28" id="ysX-5T-3eG"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="Qdr-zC-gg2"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="mapButtons" destination="BF1-Z2-4rJ" id="Ju8-fq-VTB"/>
|
||||
<outlet property="mapButtonsPaddingRight" destination="eED-Hs-eow" id="oDt-le-Sdf"/>
|
||||
<outlet property="mapButtonsPaddingTop" destination="ysX-5T-3eG" id="LrD-nb-fMg"/>
|
||||
<outlet property="mapView" destination="UJh-Fm-jmk" id="9kq-bJ-Naq"/>
|
||||
<outlet property="mapWeatherView" destination="cpf-5B-ldg" id="XHv-aG-MMo"/>
|
||||
<outlet property="statusBarBlurHeight" destination="5UE-cf-AY5" id="9HD-jh-ICJ"/>
|
||||
<outlet property="statusBlur" destination="KvC-se-dlU" id="gwu-5p-fR5"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Dhy-Gp-pip" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
<pongPressGestureRecognizer allowableMovement="10" minimumPressDuration="0.5" id="sxv-Tw-fIc">
|
||||
<connections>
|
||||
<action selector="handleLong:" destination="f2s-jC-2Ov" id="bhL-lA-T0W"/>
|
||||
</connections>
|
||||
</pongPressGestureRecognizer>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="131.25" y="81.338028169014081"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@@ -0,0 +1,437 @@
|
||||
//
|
||||
// MapsViewController.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 02/05/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MapKit
|
||||
import CoreLocation
|
||||
import ContainerControllerSwift
|
||||
|
||||
class MapsViewController: StoryboardController, MapsContainerControllerDelegate, LocationContainerControllerDelegate, RouteContainerControllerDelegate, MenuContainerControllerDelegate {
|
||||
|
||||
// MARK: - IBOutlets
|
||||
|
||||
@IBOutlet weak var mapView: MKMapView!
|
||||
|
||||
@IBOutlet weak var mapWeatherView: MapsWeatherView!
|
||||
|
||||
@IBOutlet weak var mapButtons: MapsButtons!
|
||||
@IBOutlet weak var mapButtonsPaddingTop: NSLayoutConstraint!
|
||||
@IBOutlet weak var mapButtonsPaddingRight: NSLayoutConstraint!
|
||||
|
||||
@IBOutlet weak var statusBlur: UIVisualEffectView!
|
||||
@IBOutlet weak var statusBarBlurHeight: NSLayoutConstraint!
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
var mapManager: MapViewManager!
|
||||
|
||||
var mapsContainer: MapsContainerController!
|
||||
var locationContainer: LocationContainerController?
|
||||
var routeContainer: RouteContainerController?
|
||||
var menuContainer: MenuContainerController!
|
||||
|
||||
var darkStyle: Bool = false
|
||||
var selectedIndex: Int = 0
|
||||
var showOnce: Bool = false
|
||||
|
||||
// MARK: - Life Cycle
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(rotated), name: UIDevice.orientationDidChangeNotification, object: nil)
|
||||
|
||||
updateMapManager()
|
||||
|
||||
showMapsContainer()
|
||||
|
||||
updateMapViewButtons()
|
||||
updateMapViewWeatherView()
|
||||
updateMapViewTopPadding()
|
||||
startAnimationMapElements()
|
||||
}
|
||||
|
||||
override var prefersStatusBarHidden: Bool {
|
||||
return true
|
||||
}
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
|
||||
navBar(hide: true)
|
||||
if !showOnce {
|
||||
mapsContainer.move(type: .hide, animation: false)
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
if !showOnce {
|
||||
showOnce = true
|
||||
mapsContainer.move(type: .middle)
|
||||
}
|
||||
}
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
|
||||
navBar(hide: false)
|
||||
}
|
||||
|
||||
func navBar(hide: Bool) {
|
||||
self.navigationController?.setNavigationBarHidden(hide, animated: true)
|
||||
}
|
||||
|
||||
override func viewDidDisappear(_ animated: Bool) {
|
||||
super.viewDidDisappear(animated)
|
||||
|
||||
mapsContainer.remove()
|
||||
mapsContainer = nil
|
||||
|
||||
NotificationCenter.default.removeObserver(self)
|
||||
}
|
||||
|
||||
// MARK: - StatusBar Style
|
||||
|
||||
override var preferredStatusBarStyle: UIStatusBarStyle {
|
||||
return darkStyle ? .lightContent : .default
|
||||
}
|
||||
|
||||
// MARK: - Rotation Callback
|
||||
|
||||
@objc func rotated() {
|
||||
updateMapViewTopPadding()
|
||||
}
|
||||
|
||||
func updateMapViewTopPadding() {
|
||||
|
||||
let padding: CGFloat = 8
|
||||
|
||||
statusBarBlurHeight.constant = ContainerDevice.statusBarHeight
|
||||
|
||||
let paddingX: CGFloat = (ContainerDevice.isIphoneX ? ContainerDevice.isIphoneXTop : padding)
|
||||
|
||||
var paddingWeatherTop: CGFloat = 0.0
|
||||
var paddingTop: CGFloat = 0.0
|
||||
var paddingRight: CGFloat = 0.0
|
||||
|
||||
let paddingStatusBar: CGFloat = (ContainerDevice.statusBarHeight + padding)
|
||||
|
||||
switch ContainerDevice.orientation {
|
||||
case .portrait:
|
||||
paddingTop = paddingStatusBar
|
||||
paddingRight = padding
|
||||
paddingWeatherTop = padding
|
||||
case .landscapeLeft:
|
||||
paddingTop = ContainerDevice.isIpad ? paddingStatusBar : paddingX
|
||||
paddingRight = ContainerDevice.isIphoneX ? 44 : padding
|
||||
paddingWeatherTop = paddingX
|
||||
case .landscapeRight:
|
||||
paddingTop = ContainerDevice.isIpad ? paddingStatusBar : paddingX
|
||||
paddingRight = paddingX
|
||||
paddingWeatherTop = paddingX
|
||||
}
|
||||
|
||||
var width: CGFloat = 0.0
|
||||
var height: CGFloat = 0.0
|
||||
|
||||
|
||||
switch ContainerDevice.orientation {
|
||||
case .portrait:
|
||||
width = ContainerDevice.screenMin
|
||||
height = ContainerDevice.screenMax
|
||||
case .landscapeLeft,
|
||||
.landscapeRight:
|
||||
width = ContainerDevice.screenMax
|
||||
height = ContainerDevice.screenMin
|
||||
}
|
||||
|
||||
mapWeatherView.x = (width - mapWeatherView.width - paddingRight)
|
||||
|
||||
|
||||
if ContainerDevice.isPortrait, !ContainerDevice.isIpad {
|
||||
mapWeatherView.y = (mapsContainer.view.y - mapWeatherView.height - paddingWeatherTop)
|
||||
} else {
|
||||
mapWeatherView.y = (height - mapWeatherView.height - paddingWeatherTop)
|
||||
}
|
||||
|
||||
mapButtonsPaddingTop.constant = paddingTop
|
||||
mapButtonsPaddingRight.constant = paddingRight
|
||||
|
||||
mapManager.compass.x = (ContainerDevice.width - 47)
|
||||
mapManager.compass.y = (paddingTop + mapButtons.height + 12)
|
||||
}
|
||||
|
||||
// MARK: - 🗺 Map Manager
|
||||
|
||||
func updateMapManager() {
|
||||
|
||||
mapManager = MapViewManager(mapView: mapView)
|
||||
mapManager.compass.y = (mapButtons.bottom + 12)
|
||||
mapManager.selectPinCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
_self.mapsContainer.showLocationDetails()
|
||||
}
|
||||
mapManager.changeRegionCallback = { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
_self.mapButtons.changeButtonLocation(fill: false)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - 🗺 Map Long-Press
|
||||
|
||||
@IBAction func handleLong(_ recognizer: UILongPressGestureRecognizer) {
|
||||
if routeContainer != nil { return }
|
||||
|
||||
switch recognizer.state {
|
||||
case .began:
|
||||
|
||||
mapManager.addMapPinFrom(longPress: recognizer)
|
||||
mapsContainer.showLocationDetails()
|
||||
|
||||
default: break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Map Buttons Update
|
||||
|
||||
func updateMapViewButtons() {
|
||||
|
||||
mapButtons.addBlur(darkStyle: darkStyle)
|
||||
mapButtons.alpha = 0.0
|
||||
mapButtons.buttonsActionCallback = { [weak self] (_ index: Int) in
|
||||
guard let _self = self else { return }
|
||||
|
||||
if (index == 0) {
|
||||
_self.showMenuContainer()
|
||||
} else {
|
||||
_self.mapButtons.changeButtonLocation(fill: true)
|
||||
|
||||
if let coor = _self.mapView.userLocation.location?.coordinate {
|
||||
_self.mapView.setCenter(coor, animated: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func updateMapViewWeatherView() {
|
||||
|
||||
mapWeatherView.addBlur(darkStyle: darkStyle)
|
||||
mapWeatherView.alpha = 0.0
|
||||
}
|
||||
|
||||
func startAnimationMapElements() {
|
||||
|
||||
UIView.animate(withDuration: 1.0, animations: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
_self.mapWeatherView.alpha = 1.0
|
||||
_self.mapButtons.alpha = 1.0
|
||||
})
|
||||
}
|
||||
|
||||
// MARK: - 🗺 Map Buttons Alpha
|
||||
|
||||
func mapButtons(alpha: CGFloat, animation: Bool = true) {
|
||||
if ContainerDevice.isPortrait, !ContainerDevice.isIpad {
|
||||
if animation {
|
||||
UIView.animate(withDuration: 0.15, animations: { [weak self] in
|
||||
guard let _self = self else { return }
|
||||
_self.mapButtons.alpha = alpha
|
||||
_self.mapWeatherView.alpha = alpha
|
||||
})
|
||||
} else {
|
||||
mapButtons.alpha = alpha
|
||||
mapWeatherView.alpha = alpha
|
||||
}
|
||||
} else {
|
||||
mapButtons.alpha = 1.0
|
||||
mapWeatherView.alpha = 1.0
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Change Position MapElements
|
||||
|
||||
func changePositionMapsElements(container: ContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
if type == .hide { return }
|
||||
|
||||
let result = (container.positionMiddle - position)
|
||||
var alpha: CGFloat = (1.0 - (result / 20.0))
|
||||
|
||||
if 20.0 < result {
|
||||
alpha = 0.0
|
||||
} else if result < 0.0 {
|
||||
alpha = 1.0
|
||||
}
|
||||
|
||||
if animation {
|
||||
if type == .top {
|
||||
mapButtons(alpha: 0.0, animation: true)
|
||||
} else {
|
||||
mapButtons(alpha: 1.0, animation: true)
|
||||
}
|
||||
|
||||
if type != .top {
|
||||
if ContainerDevice.isPortrait, !ContainerDevice.isIpad {
|
||||
mapWeatherView.y = (position - mapWeatherView.height - 8)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
mapButtons(alpha: alpha, animation: false)
|
||||
|
||||
if ContainerDevice.isPortrait, !ContainerDevice.isIpad {
|
||||
if result < 0.0 {
|
||||
mapWeatherView.y = (position - mapWeatherView.height - 8)
|
||||
} else {
|
||||
mapWeatherView.y = (container.positionMiddle - mapWeatherView.height - 8)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if animation, type != .top {
|
||||
view.endEditing(true)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Change Index Menu
|
||||
|
||||
func menuChange(index: Int) {
|
||||
|
||||
selectedIndex = index
|
||||
darkStyle = (index == 2)
|
||||
|
||||
mapsContainer.update(darkStyle: darkStyle)
|
||||
locationContainer?.update(darkStyle: darkStyle)
|
||||
routeContainer?.update(darkStyle: darkStyle)
|
||||
|
||||
mapButtons.addBlur(darkStyle: darkStyle)
|
||||
mapWeatherView.addBlur(darkStyle: darkStyle)
|
||||
|
||||
switch selectedIndex {
|
||||
case 0: mapView.mapType = .standard
|
||||
case 1: mapView.mapType = .mutedStandard
|
||||
case 2: mapView.mapType = .hybrid
|
||||
default: break
|
||||
}
|
||||
|
||||
let style: UIBlurEffect.Style = darkStyle ? .systemUltraThinMaterialDark : .regular
|
||||
statusBlur.effect = UIBlurEffect(style: style)
|
||||
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
}
|
||||
|
||||
// MARK: - 🦄 Show Maps-Container
|
||||
|
||||
func showMapsContainer() {
|
||||
mapsContainer = MapsContainerController(addTo: self, darkStyle: darkStyle)
|
||||
mapsContainer.mapsDelegate = self
|
||||
}
|
||||
|
||||
// MARK: Delegate
|
||||
|
||||
func mapsContainerController(showLocationDetails mapsContainerController: MapsContainerController) {
|
||||
mapsContainer.move(type: .hide)
|
||||
showLocationDetailsContainer()
|
||||
mapManager.selectPinAnimation(show: true)
|
||||
}
|
||||
|
||||
func mapsContainerController(move mapsContainerController: MapsContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
changePositionMapsElements(container: mapsContainerController, position: position, type: type, animation: animation)
|
||||
}
|
||||
|
||||
//MARK: - 🦄 Show Location-Details
|
||||
|
||||
func showLocationDetailsContainer() {
|
||||
if locationContainer != nil { return }
|
||||
|
||||
locationContainer = LocationContainerController(addTo: self, darkStyle: darkStyle)
|
||||
locationContainer?.locationDelegate = self
|
||||
locationContainer?.move(type: ContainerDevice.isPortrait ? .middle : .top)
|
||||
}
|
||||
|
||||
// MARK: Delegate
|
||||
|
||||
func locationContainerController(showRoute locationContainerController: LocationContainerController) {
|
||||
locationContainer?.move(type: .hide)
|
||||
showRouteContainer()
|
||||
mapManager.showRouteOnMapMyLocation()
|
||||
}
|
||||
|
||||
func locationContainerController(close locationContainerController: LocationContainerController) {
|
||||
mapManager.selectPinAnimation(show: false)
|
||||
|
||||
let animation = locationContainerController.oldMoveType != .middle
|
||||
|
||||
mapsContainer.move(type: .middle, animation: animation)
|
||||
}
|
||||
|
||||
func locationContainerController(closeComplection locationContainerController: LocationContainerController) {
|
||||
locationContainer = nil
|
||||
}
|
||||
|
||||
func locationContainerController(move locationContainerController: LocationContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
changePositionMapsElements(container: locationContainerController, position: position, type: type, animation: animation)
|
||||
}
|
||||
|
||||
//MARK: - 🦄 Show Route
|
||||
|
||||
func showRouteContainer() {
|
||||
if routeContainer != nil { return }
|
||||
|
||||
routeContainer = RouteContainerController(addTo: self, darkStyle: darkStyle)
|
||||
routeContainer?.routeDelegate = self
|
||||
routeContainer?.move(type: ContainerDevice.isPortrait ? .middle : .top)
|
||||
}
|
||||
|
||||
// MARK: Delegate
|
||||
|
||||
func routeContainerController(close routeContainerController: RouteContainerController) {
|
||||
mapManager.closeRoute(showSelectPin: true)
|
||||
locationContainer?.move(type: .middle)
|
||||
}
|
||||
|
||||
func routeContainerController(closeComplection routeContainerController: RouteContainerController) {
|
||||
routeContainer = nil
|
||||
}
|
||||
|
||||
func routeContainerController(move routeContainerController: RouteContainerController, position: CGFloat, type: ContainerMoveType, animation: Bool) {
|
||||
changePositionMapsElements(container: routeContainerController, position: position, type: type, animation: animation)
|
||||
}
|
||||
|
||||
// MARK: - 🦄 Show Menu-Container
|
||||
|
||||
func showMenuContainer() {
|
||||
if menuContainer != nil { return }
|
||||
|
||||
menuContainer = MenuContainerController(addTo: self, darkStyle: darkStyle, selectedIndex: selectedIndex)
|
||||
menuContainer?.menuDelegate = self
|
||||
|
||||
mapButtons(alpha: 0.0)
|
||||
}
|
||||
|
||||
// MARK: Delegate
|
||||
|
||||
func menuContainerController(close menuContainerController: MenuContainerController) {
|
||||
mapButtons(alpha: 1.0)
|
||||
}
|
||||
|
||||
func menuContainerController(closeComplection menuContainerController: MenuContainerController) {
|
||||
menuContainer = nil
|
||||
}
|
||||
|
||||
func menuContainerController(segment menuContainerController: MenuContainerController, selectedIndex: Int) {
|
||||
menuChange(index: selectedIndex)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class LocationAddressCellItem: TableAdapterItem {
|
||||
|
||||
init(title: String? = nil,
|
||||
subtitle: String? = nil,
|
||||
darkStyle: Bool = false) {
|
||||
|
||||
let cellData = LocationAddressCellData(title, subtitle, darkStyle)
|
||||
|
||||
super.init(cellClass: LocationAddressCell .self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class LocationAddressCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String?
|
||||
var subtitle: String?
|
||||
var darkStyle: Bool
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String? = nil,
|
||||
_ subtitle: String? = nil,
|
||||
_ darkStyle: Bool) {
|
||||
|
||||
self.title = title
|
||||
self.subtitle = subtitle
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 159
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class LocationAddressCell : TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: LocationAddressCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet private weak var textLabel2: UILabel?
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? LocationAddressCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.text = _L("LNG_MAPS_ADDRESS")
|
||||
textLabel2?.text = "\(_L("LNG_MAPS_STREET")), 16c2, .....\n\(_L("LNG_MAPS_CITY"))\n\(_L("LNG_MAPS_COUNTRY"))\n101000"
|
||||
|
||||
textLabel2?.textColor = data.darkStyle ? .white : .black
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?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="none" indentationWidth="10" id="f2l-3p-uee" customClass="LocationAddressCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="159"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="f2l-3p-uee" id="3Bv-wN-gVG">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="159"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VKk-lv-YQm">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="159"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Address" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="aWx-3x-09I">
|
||||
<rect key="frame" x="16" y="22" width="56.5" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" white="0.5" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vxH-ZE-iw0">
|
||||
<rect key="frame" x="16" y="42" width="343" height="95"/>
|
||||
<attributedString key="attributedText">
|
||||
<fragment content="Street № 5108
City
Country
1111111">
|
||||
<attributes>
|
||||
<color key="NSColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
<font key="NSFont" metaFont="system" size="17"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="natural" lineBreakMode="wordWrapping" baseWritingDirection="natural" lineSpacing="4.2999999999999998" tighteningFactorForTruncation="0.0"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
</attributedString>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="vxH-ZE-iw0" firstAttribute="leading" secondItem="VKk-lv-YQm" secondAttribute="leading" constant="16" id="DMM-mg-xKk"/>
|
||||
<constraint firstItem="vxH-ZE-iw0" firstAttribute="top" secondItem="VKk-lv-YQm" secondAttribute="top" constant="42" id="KPn-hK-zl7"/>
|
||||
<constraint firstAttribute="trailing" secondItem="vxH-ZE-iw0" secondAttribute="trailing" constant="16" id="KgK-JU-gc8"/>
|
||||
<constraint firstAttribute="bottom" secondItem="vxH-ZE-iw0" secondAttribute="bottom" constant="22" id="Ryl-mq-b7N"/>
|
||||
<constraint firstItem="aWx-3x-09I" firstAttribute="top" secondItem="VKk-lv-YQm" secondAttribute="top" constant="22" id="gt2-Pr-SBe"/>
|
||||
<constraint firstItem="aWx-3x-09I" firstAttribute="leading" secondItem="VKk-lv-YQm" secondAttribute="leading" constant="16" id="k4f-Qx-sH9"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="VKk-lv-YQm" firstAttribute="leading" secondItem="3Bv-wN-gVG" secondAttribute="leading" id="23Z-pC-4r7"/>
|
||||
<constraint firstAttribute="bottom" secondItem="VKk-lv-YQm" secondAttribute="bottom" id="Nq0-dX-zaA"/>
|
||||
<constraint firstItem="VKk-lv-YQm" firstAttribute="top" secondItem="3Bv-wN-gVG" secondAttribute="top" id="ONz-Ps-Q5G"/>
|
||||
<constraint firstAttribute="trailing" secondItem="VKk-lv-YQm" secondAttribute="trailing" id="jMU-VX-5ft"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="textLabel2" destination="vxH-ZE-iw0" id="PlJ-mK-Uz3"/>
|
||||
<outlet property="titleLabel" destination="aWx-3x-09I" id="dAe-zi-af0"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="127.2" y="111.0944527736132"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
enum LocationButtonCellType {
|
||||
case blue // 0 122 255
|
||||
case gray // 0 0 0 9%
|
||||
}
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class LocationButtonCellItem: TableAdapterItem {
|
||||
|
||||
init(title: String? = nil,
|
||||
subtitle: String? = nil,
|
||||
type: LocationButtonCellType,
|
||||
clickCallback: (() -> ())? = nil) {
|
||||
|
||||
let cellData = LocationButtonCellData(title, subtitle, type, clickCallback)
|
||||
|
||||
super.init(cellClass: LocationButtonCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
open class LocationButtonCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String?
|
||||
var subtitle: String?
|
||||
var type: LocationButtonCellType
|
||||
var clickCallback: (() -> ())?
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String? = nil,
|
||||
_ subtitle: String? = nil,
|
||||
_ type: LocationButtonCellType,
|
||||
_ clickCallback:(() -> ())?) {
|
||||
|
||||
self.title = title
|
||||
self.subtitle = subtitle
|
||||
self.type = type
|
||||
self.clickCallback = clickCallback
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 62
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class LocationButtonCell : TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: LocationButtonCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var button: DesignButton?
|
||||
|
||||
@IBOutlet weak var view2: UIView!
|
||||
@IBOutlet private weak var titleLabel2: UILabel?
|
||||
|
||||
@IBOutlet weak var view: UIView!
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet private weak var subtitleLabel: UILabel?
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? LocationButtonCellData else { return }
|
||||
self.data = data
|
||||
|
||||
|
||||
switch data.type {
|
||||
case .blue:
|
||||
view.alpha = 1.0
|
||||
view2.alpha = 0.0
|
||||
|
||||
titleLabel?.text = data.title ?? ""
|
||||
subtitleLabel?.text = data.subtitle ?? ""
|
||||
// titleLabelY?.constant = 15
|
||||
// titleLabel?.textColor = .white
|
||||
// subtitleLabel?.textColor = .white
|
||||
// button?.fillColor = .systemBlue
|
||||
// button?.hideAnimation = false
|
||||
|
||||
case .gray:
|
||||
|
||||
view.alpha = 0.0
|
||||
view2.alpha = 1.0
|
||||
titleLabel2?.text = data.title ?? ""
|
||||
// titleLabelY?.constant = 23
|
||||
// titleLabel?.textColor = .systemBlue
|
||||
// subtitleLabel?.textColor = .systemBlue
|
||||
// button?.fillColor = Colors.rgba(130, 130, 130, 0.15)
|
||||
// button?.hideAnimation = true
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@IBAction func buttonClickAction(_ sender: Any) {
|
||||
data?.clickCallback?()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
<?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="none" indentationWidth="10" id="jdx-nx-Zfb" customClass="LocationButtonCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="62"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="jdx-nx-Zfb" id="dc0-Fe-e3H">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="62"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bhS-iM-Rym">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="62"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="bxF-Ot-WsK" customClass="DesignButton" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="5" width="288" height="52"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/>
|
||||
<state key="normal">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="hideAnimation" value="NO"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="buttonClickAction:" destination="jdx-nx-Zfb" eventType="touchUpInside" id="BYk-4s-gPi"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Directions" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Shd-Nj-jla">
|
||||
<rect key="frame" x="0.0" y="15" width="320" height="16"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="25 min drive" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hSb-6T-owy">
|
||||
<rect key="frame" x="0.0" y="31" width="320" height="16"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="light" pointSize="13"/>
|
||||
<color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="bxF-Ot-WsK" secondAttribute="bottom" constant="5" id="6u4-rJ-Xtn"/>
|
||||
<constraint firstItem="Shd-Nj-jla" firstAttribute="top" secondItem="bhS-iM-Rym" secondAttribute="top" constant="15" id="7gt-I1-el8"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Shd-Nj-jla" secondAttribute="trailing" id="CaR-Va-OTE"/>
|
||||
<constraint firstItem="bxF-Ot-WsK" firstAttribute="leading" secondItem="bhS-iM-Rym" secondAttribute="leading" constant="16" id="Hk8-US-IlI"/>
|
||||
<constraint firstItem="Shd-Nj-jla" firstAttribute="leading" secondItem="bhS-iM-Rym" secondAttribute="leading" id="LtM-CR-5gx"/>
|
||||
<constraint firstAttribute="trailing" secondItem="bxF-Ot-WsK" secondAttribute="trailing" constant="16" id="azB-1G-bOc"/>
|
||||
<constraint firstItem="bxF-Ot-WsK" firstAttribute="top" secondItem="bhS-iM-Rym" secondAttribute="top" constant="5" id="nct-FV-EMP"/>
|
||||
<constraint firstAttribute="trailing" secondItem="hSb-6T-owy" secondAttribute="trailing" id="xRc-7m-W8I"/>
|
||||
<constraint firstItem="hSb-6T-owy" firstAttribute="top" secondItem="Shd-Nj-jla" secondAttribute="bottom" id="ybo-wV-zLo"/>
|
||||
<constraint firstItem="hSb-6T-owy" firstAttribute="leading" secondItem="bhS-iM-Rym" secondAttribute="leading" id="zdK-1R-xCi"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hp7-D3-7Oy">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="62"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="h0N-qi-JcE" customClass="DesignButton" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="16" y="5" width="288" height="52"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="14"/>
|
||||
<state key="normal">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.4950042517006803" alpha="0.15213116496598639" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="hideAnimation" value="YES"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<action selector="buttonClickAction:" destination="jdx-nx-Zfb" eventType="touchUpInside" id="OWt-St-OaV"/>
|
||||
</connections>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Directions" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6qi-jY-2bC">
|
||||
<rect key="frame" x="0.0" y="23" width="320" height="16"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/>
|
||||
<color key="textColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="h0N-qi-JcE" firstAttribute="top" secondItem="hp7-D3-7Oy" secondAttribute="top" constant="5" id="0j2-54-L2G"/>
|
||||
<constraint firstAttribute="trailing" secondItem="h0N-qi-JcE" secondAttribute="trailing" constant="16" id="40R-jD-PM6"/>
|
||||
<constraint firstAttribute="bottom" secondItem="h0N-qi-JcE" secondAttribute="bottom" constant="5" id="50d-99-hlu"/>
|
||||
<constraint firstItem="6qi-jY-2bC" firstAttribute="leading" secondItem="hp7-D3-7Oy" secondAttribute="leading" id="Xl6-Lk-2Uo"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6qi-jY-2bC" secondAttribute="trailing" id="gjg-bj-v0Y"/>
|
||||
<constraint firstItem="6qi-jY-2bC" firstAttribute="top" secondItem="hp7-D3-7Oy" secondAttribute="top" constant="23" id="o2w-CC-Ojf"/>
|
||||
<constraint firstItem="h0N-qi-JcE" firstAttribute="leading" secondItem="hp7-D3-7Oy" secondAttribute="leading" constant="16" id="vRK-Bg-xZ6"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="bhS-iM-Rym" secondAttribute="trailing" id="Hd9-s6-evS"/>
|
||||
<constraint firstItem="hp7-D3-7Oy" firstAttribute="top" secondItem="dc0-Fe-e3H" secondAttribute="top" id="frT-0b-VAZ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="bhS-iM-Rym" secondAttribute="bottom" id="k3P-Eu-hAl"/>
|
||||
<constraint firstItem="bhS-iM-Rym" firstAttribute="top" secondItem="dc0-Fe-e3H" secondAttribute="top" id="lAa-M2-2H9"/>
|
||||
<constraint firstItem="hp7-D3-7Oy" firstAttribute="leading" secondItem="dc0-Fe-e3H" secondAttribute="leading" id="oaC-8J-Ylo"/>
|
||||
<constraint firstItem="bhS-iM-Rym" firstAttribute="leading" secondItem="dc0-Fe-e3H" secondAttribute="leading" id="uOv-ew-xID"/>
|
||||
<constraint firstAttribute="trailing" secondItem="hp7-D3-7Oy" secondAttribute="trailing" id="xyX-CM-6eu"/>
|
||||
<constraint firstAttribute="bottom" secondItem="hp7-D3-7Oy" secondAttribute="bottom" id="z2o-VQ-jtc"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="subtitleLabel" destination="hSb-6T-owy" id="eSg-e2-ddE"/>
|
||||
<outlet property="titleLabel" destination="Shd-Nj-jla" id="sOA-w8-IDh"/>
|
||||
<outlet property="titleLabel2" destination="6qi-jY-2bC" id="q4q-vh-Ulc"/>
|
||||
<outlet property="view" destination="bhS-iM-Rym" id="H3E-xm-whs"/>
|
||||
<outlet property="view2" destination="hp7-D3-7Oy" id="U3K-dk-Bsc"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="75" y="184"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class LocationCollectionsButtonCellItem: TableAdapterItem {
|
||||
|
||||
init() {
|
||||
|
||||
let cellData = LocationCollectionsButtonCellData()
|
||||
|
||||
super.init(cellClass: LocationCollectionsButtonCell .self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class LocationCollectionsButtonCellData: TableAdapterCellData {
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 124
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class LocationCollectionsButtonCell : TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: LocationCollectionsButtonCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet private weak var removeLabel: UILabel?
|
||||
@IBOutlet private weak var addtoLabel: UILabel?
|
||||
@IBOutlet private weak var shareLabel: UILabel?
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? LocationCollectionsButtonCellData else { return }
|
||||
self.data = data
|
||||
|
||||
removeLabel?.text = _L("LNG_MAPS_REMOVE")
|
||||
addtoLabel?.text = "\(_L("LNG_MAPS_ADD")) \(_L("LNG_MAPS_TO"))..."
|
||||
shareLabel?.text = _L("LNG_MAPS_SHARE")
|
||||
}
|
||||
}
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
<?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="none" indentationWidth="10" id="f2l-3p-uee" customClass="LocationCollectionsButtonCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="124"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="f2l-3p-uee" id="3Bv-wN-gVG">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="124"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VQ0-LA-XVs">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="124"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Vo4-nv-ZDg" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="11" y="0.0" width="149" height="62"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="E3E-yX-aTV" customClass="DesignButton" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="5" y="5" width="139" height="52"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.50196078431372548" green="0.49803921568627452" blue="0.49803921568627452" alpha="0.15343324830190475" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</button>
|
||||
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ykx-zK-GhF">
|
||||
<rect key="frame" x="5" y="5" width="139" height="37"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="37" id="y9P-ba-qr7"/>
|
||||
</constraints>
|
||||
<state key="normal" image="trash.fill" catalog="system"/>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Remove" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ADp-A0-9gD">
|
||||
<rect key="frame" x="35" y="39" width="79" height="13.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Ykx-zK-GhF" firstAttribute="leading" secondItem="Vo4-nv-ZDg" secondAttribute="leading" constant="5" id="6AF-ry-4Pc"/>
|
||||
<constraint firstAttribute="height" constant="62" id="6gG-Vr-mPN"/>
|
||||
<constraint firstItem="ADp-A0-9gD" firstAttribute="top" secondItem="Vo4-nv-ZDg" secondAttribute="top" constant="39" id="6n2-fF-OAA"/>
|
||||
<constraint firstItem="Ykx-zK-GhF" firstAttribute="top" secondItem="Vo4-nv-ZDg" secondAttribute="top" constant="5" id="U2w-fY-Idh"/>
|
||||
<constraint firstItem="ADp-A0-9gD" firstAttribute="leading" secondItem="Vo4-nv-ZDg" secondAttribute="leading" constant="35" id="WPf-xV-LPd"/>
|
||||
<constraint firstItem="E3E-yX-aTV" firstAttribute="top" secondItem="Vo4-nv-ZDg" secondAttribute="top" constant="5" id="WTY-LN-mbZ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ADp-A0-9gD" secondAttribute="trailing" constant="35" id="a8h-ss-s2L"/>
|
||||
<constraint firstItem="E3E-yX-aTV" firstAttribute="leading" secondItem="Vo4-nv-ZDg" secondAttribute="leading" constant="5" id="hg1-ME-nDH"/>
|
||||
<constraint firstAttribute="trailing" secondItem="E3E-yX-aTV" secondAttribute="trailing" constant="5" id="oAE-Fv-uRg"/>
|
||||
<constraint firstAttribute="bottom" secondItem="E3E-yX-aTV" secondAttribute="bottom" constant="5" id="qpg-oG-0mj"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Ykx-zK-GhF" secondAttribute="trailing" constant="5" id="vYV-Ja-chC"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hQA-wd-Zmp" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="160" y="0.0" width="149" height="62"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="efr-fa-kpU" customClass="DesignButton" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="5" y="5" width="139" height="52"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.50196078431372548" green="0.49803921568627452" blue="0.49803921568627452" alpha="0.14885629251700677" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</button>
|
||||
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="1mo-ty-kBd">
|
||||
<rect key="frame" x="5" y="5" width="139" height="37"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="37" id="URy-gD-Cuf"/>
|
||||
</constraints>
|
||||
<state key="normal" image="plus.app.fill" catalog="system">
|
||||
<color key="titleColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Add to..." textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bGT-rR-2GG">
|
||||
<rect key="frame" x="35" y="39" width="79" height="13.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="efr-fa-kpU" firstAttribute="top" secondItem="hQA-wd-Zmp" secondAttribute="top" constant="5" id="4vP-lh-Kdv"/>
|
||||
<constraint firstAttribute="trailing" secondItem="efr-fa-kpU" secondAttribute="trailing" constant="5" id="BWd-rn-DLh"/>
|
||||
<constraint firstAttribute="trailing" secondItem="1mo-ty-kBd" secondAttribute="trailing" constant="5" id="ETa-4X-dcV"/>
|
||||
<constraint firstAttribute="bottom" secondItem="efr-fa-kpU" secondAttribute="bottom" constant="5" id="LJs-W3-seS"/>
|
||||
<constraint firstAttribute="trailing" secondItem="bGT-rR-2GG" secondAttribute="trailing" constant="35" id="Lup-6s-BoO"/>
|
||||
<constraint firstAttribute="height" constant="62" id="SQm-Ch-vpB"/>
|
||||
<constraint firstItem="efr-fa-kpU" firstAttribute="leading" secondItem="hQA-wd-Zmp" secondAttribute="leading" constant="5" id="TAV-Oj-sb0"/>
|
||||
<constraint firstItem="1mo-ty-kBd" firstAttribute="top" secondItem="hQA-wd-Zmp" secondAttribute="top" constant="5" id="Xbu-8c-R6E"/>
|
||||
<constraint firstItem="bGT-rR-2GG" firstAttribute="top" secondItem="hQA-wd-Zmp" secondAttribute="top" constant="39" id="kNQ-Ak-rxo"/>
|
||||
<constraint firstItem="1mo-ty-kBd" firstAttribute="leading" secondItem="hQA-wd-Zmp" secondAttribute="leading" constant="5" id="nkf-WT-TAx"/>
|
||||
<constraint firstItem="bGT-rR-2GG" firstAttribute="leading" secondItem="hQA-wd-Zmp" secondAttribute="leading" constant="35" id="wYc-tD-UdV"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SvS-7a-R7X" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="11" y="62" width="149" height="62"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NyJ-lk-M8s" customClass="DesignButton" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="5" y="5" width="139" height="52"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.50196078431372548" green="0.49803921568627452" blue="0.49803921568627452" alpha="0.14633822279170067" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</button>
|
||||
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="25I-2C-wuO">
|
||||
<rect key="frame" x="5" y="5" width="139" height="37"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="37" id="duj-ke-d0V"/>
|
||||
</constraints>
|
||||
<state key="normal" image="square.and.arrow.up" catalog="system"/>
|
||||
</button>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Share" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7fI-c1-e2H">
|
||||
<rect key="frame" x="35" y="39" width="79" height="13.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="NyJ-lk-M8s" secondAttribute="bottom" constant="5" id="8xl-jG-iVA"/>
|
||||
<constraint firstItem="NyJ-lk-M8s" firstAttribute="top" secondItem="SvS-7a-R7X" secondAttribute="top" constant="5" id="CPz-Tf-zjk"/>
|
||||
<constraint firstItem="NyJ-lk-M8s" firstAttribute="leading" secondItem="SvS-7a-R7X" secondAttribute="leading" constant="5" id="In2-Rx-pvm"/>
|
||||
<constraint firstItem="25I-2C-wuO" firstAttribute="top" secondItem="SvS-7a-R7X" secondAttribute="top" constant="5" id="JKW-ey-rbo"/>
|
||||
<constraint firstAttribute="trailing" secondItem="NyJ-lk-M8s" secondAttribute="trailing" constant="5" id="L0X-gC-GlW"/>
|
||||
<constraint firstItem="7fI-c1-e2H" firstAttribute="top" secondItem="SvS-7a-R7X" secondAttribute="top" constant="39" id="Vxe-5Q-dKi"/>
|
||||
<constraint firstItem="25I-2C-wuO" firstAttribute="leading" secondItem="SvS-7a-R7X" secondAttribute="leading" constant="5" id="bJA-cc-2IO"/>
|
||||
<constraint firstAttribute="height" constant="62" id="g7m-AX-fxF"/>
|
||||
<constraint firstAttribute="trailing" secondItem="7fI-c1-e2H" secondAttribute="trailing" constant="35" id="r3F-h3-NbO"/>
|
||||
<constraint firstAttribute="trailing" secondItem="25I-2C-wuO" secondAttribute="trailing" constant="5" id="rhy-8I-deh"/>
|
||||
<constraint firstItem="7fI-c1-e2H" firstAttribute="leading" secondItem="SvS-7a-R7X" secondAttribute="leading" constant="35" id="z1N-7G-7KF"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Vo4-nv-ZDg" firstAttribute="leading" secondItem="VQ0-LA-XVs" secondAttribute="leading" constant="11" id="2NG-Dr-lWy"/>
|
||||
<constraint firstItem="hQA-wd-Zmp" firstAttribute="width" secondItem="VQ0-LA-XVs" secondAttribute="width" multiplier="0.465625" id="OGA-qP-wwA"/>
|
||||
<constraint firstItem="SvS-7a-R7X" firstAttribute="leading" secondItem="VQ0-LA-XVs" secondAttribute="leading" constant="11" id="OU8-Mm-ser"/>
|
||||
<constraint firstItem="SvS-7a-R7X" firstAttribute="width" secondItem="VQ0-LA-XVs" secondAttribute="width" multiplier="0.465625" id="Qoe-qX-rhp"/>
|
||||
<constraint firstItem="Vo4-nv-ZDg" firstAttribute="width" secondItem="VQ0-LA-XVs" secondAttribute="width" multiplier="0.465625" id="U6a-ab-BZT"/>
|
||||
<constraint firstAttribute="trailing" secondItem="hQA-wd-Zmp" secondAttribute="trailing" constant="11" id="Uod-QW-ONJ"/>
|
||||
<constraint firstItem="hQA-wd-Zmp" firstAttribute="top" secondItem="VQ0-LA-XVs" secondAttribute="top" id="WdF-0d-Syi"/>
|
||||
<constraint firstAttribute="bottom" secondItem="SvS-7a-R7X" secondAttribute="bottom" id="XmE-y6-a4i"/>
|
||||
<constraint firstItem="Vo4-nv-ZDg" firstAttribute="top" secondItem="VQ0-LA-XVs" secondAttribute="top" id="gLf-kn-eoP"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="VQ0-LA-XVs" firstAttribute="leading" secondItem="3Bv-wN-gVG" secondAttribute="leading" id="HOr-oE-B9c"/>
|
||||
<constraint firstAttribute="bottom" secondItem="VQ0-LA-XVs" secondAttribute="bottom" id="Hom-vC-Hrm"/>
|
||||
<constraint firstItem="VQ0-LA-XVs" firstAttribute="top" secondItem="3Bv-wN-gVG" secondAttribute="top" id="Qej-Wc-azm"/>
|
||||
<constraint firstAttribute="trailing" secondItem="VQ0-LA-XVs" secondAttribute="trailing" id="mBu-rQ-FNW"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="addtoLabel" destination="bGT-rR-2GG" id="ocp-Ix-Bv4"/>
|
||||
<outlet property="removeLabel" destination="ADp-A0-9gD" id="c9C-7B-866"/>
|
||||
<outlet property="shareLabel" destination="7fI-c1-e2H" id="TJ0-Ig-eLu"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="127.2" y="111.0944527736132"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="plus.app.fill" catalog="system" width="64" height="56"/>
|
||||
<image name="square.and.arrow.up" catalog="system" width="56" height="64"/>
|
||||
<image name="trash.fill" catalog="system" width="60" height="64"/>
|
||||
</resources>
|
||||
</document>
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class LocationCoordinateCellItem: TableAdapterItem {
|
||||
|
||||
init(title: String? = nil,
|
||||
subtitle: String? = nil,
|
||||
darkStyle: Bool = false) {
|
||||
|
||||
let cellData = LocationCoordinateCellData(title, subtitle, darkStyle)
|
||||
|
||||
super.init(cellClass: LocationCoordinateCell .self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class LocationCoordinateCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String?
|
||||
var subtitle: String?
|
||||
var darkStyle: Bool
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String? = nil,
|
||||
_ subtitle: String? = nil,
|
||||
_ darkStyle: Bool) {
|
||||
|
||||
self.title = title
|
||||
self.subtitle = subtitle
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 89
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class LocationCoordinateCell : TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: LocationCoordinateCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet weak var latitudeLabel: UILabel!
|
||||
@IBOutlet weak var latitudeValueLabel: UILabel!
|
||||
|
||||
@IBOutlet weak var longitudeLabel: UILabel!
|
||||
@IBOutlet weak var longitudeValueLabel: UILabel!
|
||||
|
||||
|
||||
@IBOutlet public weak var separatorView: UIView?
|
||||
@IBOutlet weak var separatorHeight: NSLayoutConstraint?
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
separatorHeight?.constant = 0.5
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? LocationCoordinateCellData else { return }
|
||||
self.data = data
|
||||
|
||||
let color: UIColor = data.darkStyle ? .white : .black
|
||||
|
||||
latitudeLabel.text = _L("LNG_MAPS_LOCATION_LATITUDE")
|
||||
longitudeLabel.text = _L("LNG_MAPS_LOCATION_LONGITUDE")
|
||||
|
||||
latitudeLabel.textColor = color
|
||||
latitudeValueLabel.textColor = color
|
||||
|
||||
longitudeLabel.textColor = color
|
||||
longitudeValueLabel.textColor = color
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
<?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="none" indentationWidth="10" id="f2l-3p-uee" customClass="LocationCoordinateCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="89"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="f2l-3p-uee" id="3Bv-wN-gVG">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="89"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RUz-Xu-MJC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="89"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="2BW-OF-VOy">
|
||||
<rect key="frame" x="16" y="21" width="144" height="57"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Latitude" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="O4Z-GU-Zzm">
|
||||
<rect key="frame" x="0.0" y="6" width="66" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="55,6028" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PHa-x5-DVB">
|
||||
<rect key="frame" x="0.0" y="31" width="65" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="144" id="89O-59-1OW"/>
|
||||
<constraint firstItem="PHa-x5-DVB" firstAttribute="leading" secondItem="2BW-OF-VOy" secondAttribute="leading" id="8VJ-4l-1TM"/>
|
||||
<constraint firstItem="PHa-x5-DVB" firstAttribute="top" secondItem="O4Z-GU-Zzm" secondAttribute="bottom" constant="4.5" id="Zzw-W2-8T2"/>
|
||||
<constraint firstItem="O4Z-GU-Zzm" firstAttribute="leading" secondItem="2BW-OF-VOy" secondAttribute="leading" id="dde-7B-MTu"/>
|
||||
<constraint firstAttribute="height" constant="57" id="fzo-xh-OfY"/>
|
||||
<constraint firstItem="O4Z-GU-Zzm" firstAttribute="top" secondItem="2BW-OF-VOy" secondAttribute="top" constant="6" id="lI7-pR-gxX"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="GIz-uF-vcg">
|
||||
<rect key="frame" x="160" y="21" width="144" height="57"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Longitude" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1CC-IC-loe">
|
||||
<rect key="frame" x="0.0" y="6" width="80.5" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="37,6396" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OdR-09-IJM">
|
||||
<rect key="frame" x="0.0" y="31" width="63.5" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="OdR-09-IJM" firstAttribute="top" secondItem="1CC-IC-loe" secondAttribute="bottom" constant="4.5" id="AMf-N3-oDd"/>
|
||||
<constraint firstAttribute="width" constant="144" id="E6C-hB-I7b"/>
|
||||
<constraint firstItem="OdR-09-IJM" firstAttribute="leading" secondItem="GIz-uF-vcg" secondAttribute="leading" id="JfJ-db-3F4"/>
|
||||
<constraint firstItem="1CC-IC-loe" firstAttribute="leading" secondItem="GIz-uF-vcg" secondAttribute="leading" id="QWy-5B-ZYq"/>
|
||||
<constraint firstItem="1CC-IC-loe" firstAttribute="top" secondItem="GIz-uF-vcg" secondAttribute="top" constant="6" id="TiE-eN-pF4"/>
|
||||
<constraint firstAttribute="height" constant="57" id="WWh-bP-ydX"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="cn6-BJ-hcD">
|
||||
<rect key="frame" x="16" y="83" width="288" height="1"/>
|
||||
<color key="backgroundColor" red="0.50196078431372548" green="0.50196078431372548" blue="0.50196078431372548" alpha="0.59946322278911568" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="vRG-Ta-FdW"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="GIz-uF-vcg" firstAttribute="centerX" secondItem="RUz-Xu-MJC" secondAttribute="centerX" constant="72" id="BEO-em-49E"/>
|
||||
<constraint firstAttribute="bottom" secondItem="cn6-BJ-hcD" secondAttribute="bottom" constant="5" id="Dcz-1e-Ybc"/>
|
||||
<constraint firstAttribute="trailing" secondItem="cn6-BJ-hcD" secondAttribute="trailing" constant="16" id="I29-Mr-3xf"/>
|
||||
<constraint firstItem="cn6-BJ-hcD" firstAttribute="leading" secondItem="RUz-Xu-MJC" secondAttribute="leading" constant="16" id="OMu-nn-Dgd"/>
|
||||
<constraint firstItem="GIz-uF-vcg" firstAttribute="top" secondItem="RUz-Xu-MJC" secondAttribute="top" constant="21" id="SVk-Xc-w1r"/>
|
||||
<constraint firstItem="2BW-OF-VOy" firstAttribute="top" secondItem="RUz-Xu-MJC" secondAttribute="top" constant="21" id="dbP-ec-blL"/>
|
||||
<constraint firstItem="2BW-OF-VOy" firstAttribute="leading" secondItem="RUz-Xu-MJC" secondAttribute="leading" constant="16" id="gfU-Dx-kjg"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="RUz-Xu-MJC" secondAttribute="bottom" id="TfI-Eg-mWd"/>
|
||||
<constraint firstItem="RUz-Xu-MJC" firstAttribute="leading" secondItem="3Bv-wN-gVG" secondAttribute="leading" id="iEV-l0-gOa"/>
|
||||
<constraint firstAttribute="trailing" secondItem="RUz-Xu-MJC" secondAttribute="trailing" id="mgV-gD-hya"/>
|
||||
<constraint firstItem="RUz-Xu-MJC" firstAttribute="top" secondItem="3Bv-wN-gVG" secondAttribute="top" id="zAl-Wo-TEF"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="latitudeLabel" destination="O4Z-GU-Zzm" id="q8t-B4-gDz"/>
|
||||
<outlet property="latitudeValueLabel" destination="PHa-x5-DVB" id="sn1-nr-Wa9"/>
|
||||
<outlet property="longitudeLabel" destination="1CC-IC-loe" id="526-1N-8Kg"/>
|
||||
<outlet property="longitudeValueLabel" destination="OdR-09-IJM" id="x7D-uU-wbn"/>
|
||||
<outlet property="separatorHeight" destination="vRG-Ta-FdW" id="Rmg-3c-eJe"/>
|
||||
<outlet property="separatorView" destination="cn6-BJ-hcD" id="aVb-5i-c3m"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="127.2" y="111.0944527736132"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class LocationTextCellItem: TableAdapterItem {
|
||||
|
||||
init(title: String? = nil,
|
||||
image: UIImage? = nil) {
|
||||
|
||||
let cellData = LocationTextCellData(title, image)
|
||||
|
||||
super.init(cellClass: LocationTextCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class LocationTextCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String?
|
||||
var image: UIImage?
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String? = nil,
|
||||
_ image: UIImage? = nil) {
|
||||
|
||||
self.title = title
|
||||
self.image = image
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 61
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class LocationTextCell : TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: LocationTextCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet private weak var imageButton: DesignButton?
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? LocationTextCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.text = data.title ?? ""
|
||||
|
||||
if let image = data.image {
|
||||
imageButton?.setImage(image, for: .normal)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
<?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="none" indentationWidth="10" id="f2l-3p-uee" customClass="LocationTextCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="61"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="f2l-3p-uee" id="3Bv-wN-gVG">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="61"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZzU-qf-hXw">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="61"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Text Add " textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QwB-2C-q0H">
|
||||
<rect key="frame" x="16" y="20" width="235" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" userInteractionEnabled="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ba2-IZ-f9B" customClass="DesignButton" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="267" y="12" width="37" height="37"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="37" id="gJa-3f-2SK"/>
|
||||
<constraint firstAttribute="width" constant="37" id="ntV-dU-a1e"/>
|
||||
</constraints>
|
||||
<state key="normal" image="plus" catalog="system"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.5" alpha="0.15149340986653059" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="-1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</button>
|
||||
<view alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Pfh-pn-hig">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="61"/>
|
||||
<color key="backgroundColor" white="0.49936224489795916" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="ba2-IZ-f9B" secondAttribute="trailing" constant="16" id="3Yu-nS-yuC"/>
|
||||
<constraint firstItem="ba2-IZ-f9B" firstAttribute="leading" secondItem="QwB-2C-q0H" secondAttribute="trailing" constant="16" id="4oi-lH-TxJ"/>
|
||||
<constraint firstItem="QwB-2C-q0H" firstAttribute="top" secondItem="ZzU-qf-hXw" secondAttribute="top" constant="20" id="7sc-F2-vlU"/>
|
||||
<constraint firstItem="Pfh-pn-hig" firstAttribute="top" secondItem="ZzU-qf-hXw" secondAttribute="top" id="N2J-bw-NMz"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Pfh-pn-hig" secondAttribute="trailing" id="Q9d-v6-Vsd"/>
|
||||
<constraint firstItem="Pfh-pn-hig" firstAttribute="leading" secondItem="ZzU-qf-hXw" secondAttribute="leading" id="iLD-eM-g7P"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Pfh-pn-hig" secondAttribute="bottom" id="m7s-9M-nK9"/>
|
||||
<constraint firstItem="ba2-IZ-f9B" firstAttribute="top" secondItem="ZzU-qf-hXw" secondAttribute="top" constant="12" id="rZo-L6-Mr3"/>
|
||||
<constraint firstItem="QwB-2C-q0H" firstAttribute="leading" secondItem="ZzU-qf-hXw" secondAttribute="leading" constant="16" id="rgu-6j-XZ5"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="ZzU-qf-hXw" secondAttribute="bottom" id="F21-Rd-n69"/>
|
||||
<constraint firstItem="ZzU-qf-hXw" firstAttribute="top" secondItem="3Bv-wN-gVG" secondAttribute="top" id="LsM-xz-qr0"/>
|
||||
<constraint firstItem="ZzU-qf-hXw" firstAttribute="leading" secondItem="3Bv-wN-gVG" secondAttribute="leading" id="o5l-Fh-1Lq"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ZzU-qf-hXw" secondAttribute="trailing" id="vip-iJ-yaa"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="imageButton" destination="ba2-IZ-f9B" id="F81-2U-qWw"/>
|
||||
<outlet property="selectedView" destination="Pfh-pn-hig" id="SL5-G9-vl3"/>
|
||||
<outlet property="titleLabel" destination="QwB-2C-q0H" id="KBr-kK-scj"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="126.40000000000001" y="111.0944527736132"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="plus" catalog="system" width="64" height="56"/>
|
||||
</resources>
|
||||
</document>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// MapsCollectionCellView.swift
|
||||
// PatternsSwift
|
||||
//
|
||||
// Created by mrustaa on 13/05/2020.
|
||||
// Copyright © 2020 mrusta. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
@IBDesignable
|
||||
class MapsCollectionCellView: UIView {
|
||||
|
||||
override func draw(_ rect: CGRect) {
|
||||
|
||||
//// Color Declarations
|
||||
let color10 = Colors.rgba(185, 185, 185, 0.37)
|
||||
|
||||
//// Bezier Drawing
|
||||
let bezierPath = UIBezierPath()
|
||||
bezierPath.move(to: CGPoint(x: 4, y: 51))
|
||||
bezierPath.addCurve(to: CGPoint(x: 4, y: 16), controlPoint1: CGPoint(x: 3.9, y: 44.69), controlPoint2: CGPoint(x: 4, y: 24.46))
|
||||
bezierPath.addCurve(to: CGPoint(x: 16, y: 4), controlPoint1: CGPoint(x: 4, y: 6), controlPoint2: CGPoint(x: 6, y: 4))
|
||||
bezierPath.addCurve(to: CGPoint(x: 51, y: 4), controlPoint1: CGPoint(x: 26, y: 4), controlPoint2: CGPoint(x: 51, y: 4))
|
||||
bezierPath.addCurve(to: CGPoint(x: 44, y: -0), controlPoint1: CGPoint(x: 51, y: 4), controlPoint2: CGPoint(x: 50, y: -0))
|
||||
bezierPath.addCurve(to: CGPoint(x: 7, y: -0), controlPoint1: CGPoint(x: 38, y: -0), controlPoint2: CGPoint(x: 11, y: -0))
|
||||
bezierPath.addCurve(to: CGPoint(x: 0, y: 7), controlPoint1: CGPoint(x: 3, y: -0), controlPoint2: CGPoint(x: 0, y: 2))
|
||||
bezierPath.addCurve(to: CGPoint(x: 0, y: 44), controlPoint1: CGPoint(x: 0, y: 12), controlPoint2: CGPoint(x: 0, y: 34.5))
|
||||
bezierPath.addCurve(to: CGPoint(x: 4, y: 51), controlPoint1: CGPoint(x: 0, y: 50), controlPoint2: CGPoint(x: 4, y: 51))
|
||||
bezierPath.close()
|
||||
color10.setFill()
|
||||
bezierPath.fill()
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class MapsCollectionsCellItem: TableAdapterItem {
|
||||
|
||||
init() {
|
||||
let cellData = MapsCollectionsCellData()
|
||||
super.init(cellClass: MapsCollectionsCell .self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class MapsCollectionsCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 98
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class MapsCollectionsCell : TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsCollectionsCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
|
||||
var collView: MapsCollectionCellView!
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? MapsCollectionsCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.text = _L("LNG_MAPS_NEW_COLLECTION")
|
||||
|
||||
}
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
<?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="MapsCollectionsCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="98"/>
|
||||
<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="98"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ONT-71-dU0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="98"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="36L-DF-KyB" customClass="MapsCollectionCellView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="15" y="11" width="63" height="63"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="63" id="7a0-MR-jPv"/>
|
||||
<constraint firstAttribute="height" constant="63" id="Nwc-Ga-6nM"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Waf-Nj-agf" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="22" y="18" width="52" height="52"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hv9-26-5Vp" customClass="DesignButton" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="52" height="52"/>
|
||||
<state key="normal" image="plus" catalog="system"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="-1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="hv9-26-5Vp" secondAttribute="bottom" id="1Ky-au-vkC"/>
|
||||
<constraint firstAttribute="width" constant="52" id="Mpc-sk-GR8"/>
|
||||
<constraint firstAttribute="height" constant="52" id="cMa-eX-dve"/>
|
||||
<constraint firstAttribute="trailing" secondItem="hv9-26-5Vp" secondAttribute="trailing" id="fow-pe-M85"/>
|
||||
<constraint firstItem="hv9-26-5Vp" firstAttribute="leading" secondItem="Waf-Nj-agf" secondAttribute="leading" id="oDR-ED-g1H"/>
|
||||
<constraint firstItem="hv9-26-5Vp" firstAttribute="top" secondItem="Waf-Nj-agf" secondAttribute="top" id="y5i-Js-JiV"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.72549019607843135" green="0.72549019607843135" blue="0.72549019607843135" alpha="0.37034970238095244" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
|
||||
<real key="value" value="2.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="New Collection..." textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D9Q-RB-lNN">
|
||||
<rect key="frame" x="87" y="29" width="228" height="24"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="20"/>
|
||||
<color key="textColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="D9Q-RB-lNN" secondAttribute="trailing" constant="60" id="Bcg-JX-baQ"/>
|
||||
<constraint firstItem="D9Q-RB-lNN" firstAttribute="top" secondItem="ONT-71-dU0" secondAttribute="top" constant="29" id="Hg5-5V-wcW"/>
|
||||
<constraint firstItem="D9Q-RB-lNN" firstAttribute="leading" secondItem="ONT-71-dU0" secondAttribute="leading" constant="87" id="Q5e-tb-mAM"/>
|
||||
<constraint firstItem="36L-DF-KyB" firstAttribute="leading" secondItem="ONT-71-dU0" secondAttribute="leading" constant="15" id="TR4-Ov-ua5"/>
|
||||
<constraint firstItem="Waf-Nj-agf" firstAttribute="top" secondItem="ONT-71-dU0" secondAttribute="top" constant="18" id="VrY-Ra-h2l"/>
|
||||
<constraint firstItem="36L-DF-KyB" firstAttribute="top" secondItem="ONT-71-dU0" secondAttribute="top" constant="11" id="mp3-Pl-NrN"/>
|
||||
<constraint firstItem="Waf-Nj-agf" firstAttribute="leading" secondItem="ONT-71-dU0" secondAttribute="leading" constant="22" id="uM0-V8-Jgj"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SBX-VY-QTn" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="84"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="84" id="B1M-3U-LVV"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.50026573129251706" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="size" keyPath="shadowOffset">
|
||||
<size key="value" width="0.0" height="0.0"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="SBX-VY-QTn" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="3lr-vE-cPQ"/>
|
||||
<constraint firstItem="ONT-71-dU0" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="8EI-DT-HsN"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ONT-71-dU0" secondAttribute="trailing" id="FbH-It-kU1"/>
|
||||
<constraint firstItem="ONT-71-dU0" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="Ik2-or-IDu"/>
|
||||
<constraint firstAttribute="trailing" secondItem="SBX-VY-QTn" secondAttribute="trailing" id="hCN-sB-xVr"/>
|
||||
<constraint firstItem="SBX-VY-QTn" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="ngv-cW-XAc"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ONT-71-dU0" secondAttribute="bottom" id="uF5-Cl-Uxg"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="selectedView" destination="SBX-VY-QTn" id="f4e-f3-aNj"/>
|
||||
<outlet property="titleLabel" destination="D9Q-RB-lNN" id="FUw-um-oFd"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="127.2" y="111.54422788605699"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="plus" catalog="system" width="64" height="56"/>
|
||||
</resources>
|
||||
</document>
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class MapsFavoritesCellItem: TableAdapterItem {
|
||||
|
||||
init(title: String? = nil,
|
||||
subtitle: String? = nil,
|
||||
image: UIImage? = nil,
|
||||
darkStyle: Bool = false,
|
||||
clickCallback: (() -> Void)? = nil) {
|
||||
|
||||
let cellData = MapsFavoritesCellData(title, subtitle, darkStyle, clickCallback)
|
||||
|
||||
super.init(cellClass: MapsFavoritesCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class MapsFavoritesCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String?
|
||||
var subtitle: String?
|
||||
var darkStyle: Bool
|
||||
var clickCallback: (() -> Void)?
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String? = nil,
|
||||
_ subtitle: String? = nil,
|
||||
_ darkStyle: Bool,
|
||||
_ clickCallback: (() -> Void)?) {
|
||||
|
||||
self.title = title
|
||||
self.subtitle = subtitle
|
||||
self.darkStyle = darkStyle
|
||||
self.clickCallback = clickCallback
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 137
|
||||
}
|
||||
|
||||
class func collectionItems(darkStyle: Bool = false, clickCallback: (() -> Void)? = nil) -> [CollectionAdapterItem] {
|
||||
var items: [CollectionAdapterItem] = []
|
||||
items.append( MapsFavoriteItem(title: _L("LNG_MAPS_HOME"), subtitle: _L("LNG_MAPS_ADD"), colorType: .blue, image: UIImage(systemName:"house.fill"), darkStyle: darkStyle, clickCallback: { clickCallback?() }) )
|
||||
items.append( MapsFavoriteItem(title: _L("LNG_MAPS_WORK"), subtitle: _L("LNG_MAPS_ADD"), colorType: .brown, image: UIImage(systemName: "briefcase.fill"), darkStyle: darkStyle, clickCallback: { clickCallback?() }) )
|
||||
items.append( MapsFavoriteItem(title: _L("LNG_MAPS_STREET"), subtitle: "", colorType: .red, image: UIImage(systemName: "mappin"), darkStyle: darkStyle, clickCallback: { clickCallback?() }) )
|
||||
items.append( MapsFavoriteItem(title: _L("LNG_MAPS_SCORE"), subtitle: "", colorType: .orange, image: UIImage(systemName: "cart.fill"), darkStyle: darkStyle, clickCallback: { clickCallback?() }) )
|
||||
items.append( MapsFavoriteItem(title: _L("LNG_MAPS_STREET"), subtitle: "", colorType: .yellow, image: UIImage(systemName: "person.circle.fill"), darkStyle: darkStyle, clickCallback: { clickCallback?() }) )
|
||||
items.append( MapsFavoriteItem(title: _L("LNG_MAPS_ADD"), subtitle: "", colorType: .gray, image: UIImage(systemName: "plus"), darkStyle: darkStyle, clickCallback: { clickCallback?() }) )
|
||||
return items
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class MapsFavoritesCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsFavoritesCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet weak var colletionView: CollectionAdapterView!
|
||||
var items: [CollectionAdapterItem] = []
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? MapsFavoritesCellData else { return }
|
||||
self.data = data
|
||||
|
||||
items = []
|
||||
|
||||
items = MapsFavoritesCellData.collectionItems(darkStyle: data.darkStyle, clickCallback: data.clickCallback)
|
||||
|
||||
colletionView.set(items: items)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
<?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" insetsLayoutMarginsFromSafeArea="NO" selectionStyle="none" indentationWidth="10" id="ADc-Wu-299" customClass="MapsFavoritesCell" customModule="ContainerControllerSwift_Example" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="137"/>
|
||||
<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="137"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<collectionView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" alwaysBounceHorizontal="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="none" translatesAutoresizingMaskIntoConstraints="NO" id="rJA-Ae-lwF" customClass="CollectionAdapterView" customModule="ContainerControllerSwift">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="137"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<collectionViewFlowLayout key="collectionViewLayout" scrollDirection="horizontal" minimumLineSpacing="0.0" minimumInteritemSpacing="0.0" id="8zy-3T-TFU">
|
||||
<size key="itemSize" width="50" height="50"/>
|
||||
<size key="headerReferenceSize" width="0.0" height="0.0"/>
|
||||
<size key="footerReferenceSize" width="0.0" height="0.0"/>
|
||||
<inset key="sectionInset" minX="2" minY="0.0" maxX="2" maxY="0.0"/>
|
||||
</collectionViewFlowLayout>
|
||||
</collectionView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="rJA-Ae-lwF" secondAttribute="bottom" id="aeV-Wh-BNT"/>
|
||||
<constraint firstItem="rJA-Ae-lwF" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="e8C-5p-MSj"/>
|
||||
<constraint firstItem="rJA-Ae-lwF" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="jAy-ZV-yST"/>
|
||||
<constraint firstAttribute="trailing" secondItem="rJA-Ae-lwF" secondAttribute="trailing" id="whc-9V-gH6"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="colletionView" destination="rJA-Ae-lwF" id="Y2o-G6-tdn"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="127.2" y="111.0944527736132"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
enum MapsLocationCellColorType {
|
||||
case red
|
||||
case black
|
||||
}
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class MapsLocationCellItem: TableAdapterItem {
|
||||
|
||||
init(title: String? = nil,
|
||||
subtitle: String? = nil,
|
||||
colorType: MapsLocationCellColorType,
|
||||
darkStyle: Bool = false) {
|
||||
|
||||
|
||||
let cellData = MapsLocationCellData(title, subtitle, colorType, darkStyle)
|
||||
|
||||
super.init(cellClass: MapsLocationCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class MapsLocationCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String?
|
||||
var subtitle: String?
|
||||
var colorType: MapsLocationCellColorType
|
||||
var darkStyle: Bool
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String? = nil,
|
||||
_ subtitle: String? = nil,
|
||||
_ colorType: MapsLocationCellColorType,
|
||||
_ darkStyle: Bool) {
|
||||
|
||||
self.title = title
|
||||
self.subtitle = subtitle
|
||||
self.colorType = colorType
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 75
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class MapsLocationCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsLocationCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet weak var circleBlackView: DesignView!
|
||||
@IBOutlet weak var circleView: DesignView!
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet private weak var subtitleLabel: UILabel?
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
}
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? MapsLocationCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.textColor = data.darkStyle ? .white : .black
|
||||
|
||||
|
||||
if data.colorType == .red {
|
||||
circleView.alpha = 1.0
|
||||
circleBlackView.alpha = 0.0
|
||||
} else {
|
||||
circleView.alpha = 0.0
|
||||
circleBlackView.alpha = 1.0
|
||||
}
|
||||
|
||||
titleLabel?.text = data.title ?? ""
|
||||
subtitleLabel?.text = data.subtitle ?? ""
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
<?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="MapsLocationCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" 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="375" height="75"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kD1-Sb-cwH">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="75"/>
|
||||
<subviews>
|
||||
<view alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UsU-8x-BRH" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="14" y="22" width="31" height="31"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="arrow.up" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="N8r-bF-Tyg">
|
||||
<rect key="frame" x="6" y="7" width="19" height="18"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" weight="bold"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="31" id="P4w-wD-bPI"/>
|
||||
<constraint firstAttribute="width" constant="31" id="p93-3G-SXo"/>
|
||||
<constraint firstItem="N8r-bF-Tyg" firstAttribute="leading" secondItem="UsU-8x-BRH" secondAttribute="leading" constant="6" id="q8x-q6-utm"/>
|
||||
<constraint firstAttribute="bottom" secondItem="N8r-bF-Tyg" secondAttribute="bottom" constant="5" id="qcd-mi-KdL"/>
|
||||
<constraint firstItem="N8r-bF-Tyg" firstAttribute="top" secondItem="UsU-8x-BRH" secondAttribute="top" constant="6" id="xcE-jY-e10"/>
|
||||
<constraint firstAttribute="trailing" secondItem="N8r-bF-Tyg" secondAttribute="trailing" constant="6" id="zHh-aF-g0I"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.30196078431372547" green="0.30196078431372547" blue="0.30196078431372547" alpha="1" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="-1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="a1g-wA-sCi" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="14" y="22" width="31" height="31"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="mappin" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="P1E-az-wCH">
|
||||
<rect key="frame" x="6" y="6" width="19" height="20"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="P1E-az-wCH" secondAttribute="trailing" constant="6" id="5iM-hi-FJn"/>
|
||||
<constraint firstAttribute="bottom" secondItem="P1E-az-wCH" secondAttribute="bottom" constant="4.5" id="K53-lF-t7q"/>
|
||||
<constraint firstItem="P1E-az-wCH" firstAttribute="leading" secondItem="a1g-wA-sCi" secondAttribute="leading" constant="6" id="L6F-0e-bdh"/>
|
||||
<constraint firstAttribute="width" secondItem="a1g-wA-sCi" secondAttribute="height" multiplier="1:1" id="TxY-03-Gua"/>
|
||||
<constraint firstAttribute="width" constant="31" id="bv4-z2-TzD"/>
|
||||
<constraint firstAttribute="height" constant="31" id="eff-hg-ZnM"/>
|
||||
<constraint firstItem="P1E-az-wCH" firstAttribute="top" secondItem="a1g-wA-sCi" secondAttribute="top" constant="6.5" id="fk2-fG-MrQ"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.92156862750000001" green="0.37647058820000001" blue="0.27450980390000002" alpha="0.88113839289999996" colorSpace="custom" customColorSpace="displayP3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="-1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Marked Location" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ULh-fe-Uqb">
|
||||
<rect key="frame" x="56" y="16" width="305" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Directions from My Location" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DcB-qc-BNr">
|
||||
<rect key="frame" x="56" y="40" width="305" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" systemColor="systemGrayColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="UsU-8x-BRH" firstAttribute="top" secondItem="kD1-Sb-cwH" secondAttribute="top" constant="22" id="5VC-wk-gC3"/>
|
||||
<constraint firstItem="ULh-fe-Uqb" firstAttribute="top" secondItem="kD1-Sb-cwH" secondAttribute="top" constant="16" id="BvZ-um-m4Y"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ULh-fe-Uqb" secondAttribute="trailing" constant="14" id="GgZ-Kv-5dU"/>
|
||||
<constraint firstItem="DcB-qc-BNr" firstAttribute="leading" secondItem="kD1-Sb-cwH" secondAttribute="leading" constant="56" id="RWS-Df-5Jh"/>
|
||||
<constraint firstItem="a1g-wA-sCi" firstAttribute="leading" secondItem="kD1-Sb-cwH" secondAttribute="leading" constant="14" id="Vhr-IP-rYN"/>
|
||||
<constraint firstAttribute="trailing" secondItem="DcB-qc-BNr" secondAttribute="trailing" constant="14" id="Vmx-8C-hhR"/>
|
||||
<constraint firstItem="DcB-qc-BNr" firstAttribute="top" secondItem="ULh-fe-Uqb" secondAttribute="bottom" constant="3" id="YBL-iv-C3y"/>
|
||||
<constraint firstItem="ULh-fe-Uqb" firstAttribute="leading" secondItem="kD1-Sb-cwH" secondAttribute="leading" constant="56" id="ii3-fQ-iff"/>
|
||||
<constraint firstItem="a1g-wA-sCi" firstAttribute="top" secondItem="kD1-Sb-cwH" secondAttribute="top" constant="22" id="tHa-TF-dAm"/>
|
||||
<constraint firstItem="UsU-8x-BRH" firstAttribute="leading" secondItem="kD1-Sb-cwH" secondAttribute="leading" constant="14" id="xev-IW-FA3"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SBX-VY-QTn" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="75"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.49593431122448978" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
|
||||
<color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="size" keyPath="shadowOffset">
|
||||
<size key="value" width="0.0" height="0.0"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowOpacity">
|
||||
<real key="value" value="10"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowRadius">
|
||||
<real key="value" value="3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="kD1-Sb-cwH" secondAttribute="bottom" id="3C6-i0-2DF"/>
|
||||
<constraint firstItem="SBX-VY-QTn" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="3lr-vE-cPQ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="SBX-VY-QTn" secondAttribute="bottom" id="MBj-f5-7vA"/>
|
||||
<constraint firstItem="kD1-Sb-cwH" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="Yhe-uG-Vv1"/>
|
||||
<constraint firstAttribute="trailing" secondItem="SBX-VY-QTn" secondAttribute="trailing" id="hCN-sB-xVr"/>
|
||||
<constraint firstItem="SBX-VY-QTn" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="ngv-cW-XAc"/>
|
||||
<constraint firstItem="kD1-Sb-cwH" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="opY-th-YE0"/>
|
||||
<constraint firstAttribute="trailing" secondItem="kD1-Sb-cwH" secondAttribute="trailing" id="tXN-YA-aJn"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="circleBlackView" destination="UsU-8x-BRH" id="6Id-uH-dEY"/>
|
||||
<outlet property="circleView" destination="a1g-wA-sCi" id="D6w-W3-oFE"/>
|
||||
<outlet property="selectedView" destination="SBX-VY-QTn" id="f4e-f3-aNj"/>
|
||||
<outlet property="subtitleLabel" destination="DcB-qc-BNr" id="XIU-C1-zpy"/>
|
||||
<outlet property="titleLabel" destination="ULh-fe-Uqb" id="gmt-Jg-Obo"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="127.2" y="111.0944527736132"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="arrow.up" catalog="system" width="60" height="64"/>
|
||||
<image name="mappin" catalog="system" width="52" height="64"/>
|
||||
</resources>
|
||||
</document>
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class MapsSectionCellItem: TableAdapterItem {
|
||||
|
||||
init(title: String? = nil,
|
||||
textButton: String? = nil) {
|
||||
|
||||
let cellData = MapsSectionCellData(title ?? "", textButton ?? _L("LNG_MAPS_SECTION_SEE_ALL"))
|
||||
|
||||
super.init(cellClass: MapsSectionCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class MapsSectionCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String
|
||||
var textButton: String
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String,
|
||||
_ textButton: String) {
|
||||
|
||||
self.title = title
|
||||
self.textButton = textButton
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 30
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class MapsSectionCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsSectionCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet private weak var textButton: UIButton?
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? MapsSectionCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.text = data.title
|
||||
textButton?.setTitle( data.textButton, for: .normal)
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
<?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="none" indentationWidth="10" id="ADc-Wu-299" customClass="MapsSectionCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="30"/>
|
||||
<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="30"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="RfK-0z-4Rg" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="30"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Favorites" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZeO-sQ-4j3">
|
||||
<rect key="frame" x="14" y="2" width="62" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" systemColor="systemGrayColor" red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="WrF-nx-MNf">
|
||||
<rect key="frame" x="313" y="0.0" width="47" height="22"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="22" id="FZ3-Mh-btd"/>
|
||||
</constraints>
|
||||
<state key="normal" title="See All"/>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="WrF-nx-MNf" firstAttribute="top" secondItem="RfK-0z-4Rg" secondAttribute="top" id="7wc-vg-8w6"/>
|
||||
<constraint firstItem="ZeO-sQ-4j3" firstAttribute="top" secondItem="RfK-0z-4Rg" secondAttribute="top" constant="2" id="C7F-En-GuE"/>
|
||||
<constraint firstAttribute="trailing" secondItem="WrF-nx-MNf" secondAttribute="trailing" constant="15" id="Wa6-ja-uUN"/>
|
||||
<constraint firstItem="ZeO-sQ-4j3" firstAttribute="leading" secondItem="RfK-0z-4Rg" secondAttribute="leading" constant="14" id="iBC-L5-eMq"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="RfK-0z-4Rg" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="Tfp-HE-qbi"/>
|
||||
<constraint firstAttribute="trailing" secondItem="RfK-0z-4Rg" secondAttribute="trailing" id="bep-4F-QCJ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="RfK-0z-4Rg" secondAttribute="bottom" id="gI6-66-xul"/>
|
||||
<constraint firstItem="RfK-0z-4Rg" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="hT5-aJ-Hie"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="textButton" destination="WrF-nx-MNf" id="0dC-Gn-X9f"/>
|
||||
<outlet property="titleLabel" destination="ZeO-sQ-4j3" id="lvo-lz-lwo"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="127.2" y="111.54422788605699"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
|
||||
typealias SegmentIndexCallback = ((_ segmentIndex: Int) -> ())
|
||||
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class MapsMenuSegmentCellItem: TableAdapterItem {
|
||||
|
||||
init(selected: Int, darkStyle: Bool = false, selectIndexCallback: SegmentIndexCallback? = nil) {
|
||||
|
||||
let cellData = MapsMenuSegmentCellData(selected, darkStyle, selectIndexCallback)
|
||||
|
||||
super.init(cellClass: MapsMenuSegmentCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class MapsMenuSegmentCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var segmentIndexCallback: SegmentIndexCallback?
|
||||
var selectedIndex: Int
|
||||
var darkStyle: Bool
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ selected: Int, _ darkStyle: Bool, _ segmentIndexCallback: SegmentIndexCallback?) {
|
||||
|
||||
self.darkStyle = darkStyle
|
||||
self.segmentIndexCallback = segmentIndexCallback
|
||||
self.selectedIndex = selected
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 48
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class MapsMenuSegmentCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsMenuSegmentCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet weak var segment: UISegmentedControl!
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func awakeFromNib() {
|
||||
|
||||
// segment.insertSegment(withTitle: _L("LNG_MAPS_MENU_MAP"), at: 0, animated: false)
|
||||
// segment.insertSegment(withTitle: _L("LNG_MAPS_TRANSIT"), at: 1, animated: false)
|
||||
// segment.insertSegment(withTitle: _L("LNG_MAPS_MENU_SATELLITE"), at: 2, animated: false)
|
||||
|
||||
segment.setTitle(_L("LNG_MAPS_MENU_MAP"), forSegmentAt: 0)
|
||||
segment.setTitle(_L("LNG_MAPS_TRANSIT"), forSegmentAt: 1)
|
||||
segment.setTitle(_L("LNG_MAPS_MENU_SATELLITE"), forSegmentAt: 2)
|
||||
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 16.0, bottom: 0.0, right: 16.0)
|
||||
// separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
@IBAction func segmentAction(_ sender: Any) {
|
||||
data?.segmentIndexCallback?(segment.selectedSegmentIndex)
|
||||
}
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? MapsMenuSegmentCellData else { return }
|
||||
self.data = data
|
||||
|
||||
segment.setTitleTextAttributes([NSAttributedString.Key.foregroundColor: (data.darkStyle ? UIColor.white : UIColor.black)], for: .normal)
|
||||
segment.selectedSegmentTintColor = (data.darkStyle ? UIColor.white.withAlphaComponent(0.35) : UIColor.white)
|
||||
|
||||
segment.selectedSegmentIndex = data.selectedIndex
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
<?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="none" indentationWidth="10" id="ADc-Wu-299" customClass="MapsMenuSegmentCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="48"/>
|
||||
<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="320" height="48"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kn5-RB-FsG">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="48"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="7gJ-D9-9HM">
|
||||
<rect key="frame" x="16" y="9" width="288" height="30"/>
|
||||
<subviews>
|
||||
<segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="6JM-Qm-xrq">
|
||||
<rect key="frame" x="0.0" y="0.0" width="288" height="31"/>
|
||||
<segments>
|
||||
<segment title="Map"/>
|
||||
<segment title="Transit"/>
|
||||
<segment title="Satellite"/>
|
||||
</segments>
|
||||
<connections>
|
||||
<action selector="segmentAction:" destination="ADc-Wu-299" eventType="valueChanged" id="grZ-Oo-qTS"/>
|
||||
</connections>
|
||||
</segmentedControl>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="6JM-Qm-xrq" firstAttribute="top" secondItem="7gJ-D9-9HM" secondAttribute="top" id="5t8-ks-LxM"/>
|
||||
<constraint firstAttribute="bottom" secondItem="6JM-Qm-xrq" secondAttribute="bottom" id="UEY-VO-cWy"/>
|
||||
<constraint firstItem="6JM-Qm-xrq" firstAttribute="leading" secondItem="7gJ-D9-9HM" secondAttribute="leading" id="WLE-nl-qET"/>
|
||||
<constraint firstAttribute="trailing" secondItem="6JM-Qm-xrq" secondAttribute="trailing" id="drG-mj-kqt"/>
|
||||
<constraint firstAttribute="height" constant="30" id="qVG-DR-rG3"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="7gJ-D9-9HM" firstAttribute="leading" secondItem="kn5-RB-FsG" secondAttribute="leading" constant="16" id="4l3-m2-7CE"/>
|
||||
<constraint firstItem="7gJ-D9-9HM" firstAttribute="top" secondItem="kn5-RB-FsG" secondAttribute="top" constant="9" id="I7i-bM-pSi"/>
|
||||
<constraint firstAttribute="trailing" secondItem="7gJ-D9-9HM" secondAttribute="trailing" constant="16" id="Kax-JX-7W1"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="kn5-RB-FsG" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="Cik-5i-GZE"/>
|
||||
<constraint firstAttribute="trailing" secondItem="kn5-RB-FsG" secondAttribute="trailing" id="kwj-aJ-ilg"/>
|
||||
<constraint firstAttribute="bottom" secondItem="kn5-RB-FsG" secondAttribute="bottom" id="p2v-HX-BVQ"/>
|
||||
<constraint firstItem="kn5-RB-FsG" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="wEJ-s7-GHg"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="segment" destination="6JM-Qm-xrq" id="RMc-tv-JVb"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="126.40000000000001" y="111.54422788605699"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class MapsMenuSpaceCellItem: TableAdapterItem {
|
||||
|
||||
init(cellHeight: Int = 7) {
|
||||
|
||||
let cellData = MapsMenuSpaceCellData(cellHeight)
|
||||
|
||||
super.init(cellClass: MapsMenuSpaceCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class MapsMenuSpaceCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var cheight: Int
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ cellHeight: Int = 7) {
|
||||
|
||||
self.cheight = cellHeight
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return CGFloat(cheight)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class MapsMenuSpaceCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsMenuSpaceCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
override func awakeFromNib() {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
// MARK: Initialize
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? MapsMenuSpaceCellData else { return }
|
||||
self.data = data
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?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="none" indentationWidth="10" id="ADc-Wu-299" customClass="MapsMenuSpaceCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="7"/>
|
||||
<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="320" height="7"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Zp0-td-Ucm" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="7"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.050000000000000003" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Zp0-td-Ucm" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="5ET-x8-GdY"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Zp0-td-Ucm" secondAttribute="bottom" id="DgS-48-sF9"/>
|
||||
<constraint firstItem="Zp0-td-Ucm" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="lUS-O5-Dua"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Zp0-td-Ucm" secondAttribute="trailing" id="wNc-50-dAj"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<point key="canvasLocation" x="127.2" y="111.54422788605699"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class MapsMenuTextCellItem: TableAdapterItem {
|
||||
|
||||
init(title: String? = nil, switchShow: Bool = false, darkStyle: Bool = false, separator: Bool = true) {
|
||||
|
||||
let cellData = MapsMenuTextCellData(title, switchShow, darkStyle, separator)
|
||||
|
||||
super.init(cellClass: MapsMenuTextCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class MapsMenuTextCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String?
|
||||
var switchShow: Bool
|
||||
var separator: Bool
|
||||
var darkStyle: Bool
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String? = nil, _ switchShow: Bool, _ darkStyle: Bool, _ separator: Bool) {
|
||||
|
||||
self.title = title
|
||||
self.switchShow = switchShow
|
||||
self.separator = separator
|
||||
self.darkStyle = darkStyle
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 48
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class MapsMenuTextCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsMenuTextCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet private weak var hiddenSwitch: UISwitch!
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? MapsMenuTextCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.text = data.title ?? ""
|
||||
|
||||
if data.switchShow {
|
||||
selectionStyle = .none
|
||||
hiddenSwitch.alpha = 1.0
|
||||
titleLabel?.textColor = data.darkStyle ? .white : .black
|
||||
} else {
|
||||
selectionStyle = .default
|
||||
hiddenSwitch.alpha = 0.0
|
||||
titleLabel?.textColor = .systemBlue
|
||||
}
|
||||
|
||||
if data.separator {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 16.0, bottom: 0.0, right: 16.0)
|
||||
} else {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
<?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="MapsMenuTextCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="319" height="48"/>
|
||||
<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="319" height="48"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="CNB-oc-kaO">
|
||||
<rect key="frame" x="0.0" y="0.0" width="319" height="48"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="text text text" lineBreakMode="tailTruncation" numberOfLines="100" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WiD-pa-sbk">
|
||||
<rect key="frame" x="16" y="14" width="287" height="20.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.4784313738" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<switch opaque="NO" alpha="0.0" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="iTv-d4-ayC">
|
||||
<rect key="frame" x="253" y="8" width="51" height="31"/>
|
||||
</switch>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="iTv-d4-ayC" secondAttribute="trailing" constant="17" id="GaA-Jp-WQh"/>
|
||||
<constraint firstItem="iTv-d4-ayC" firstAttribute="top" secondItem="CNB-oc-kaO" secondAttribute="top" constant="8" id="HIQ-t0-U0z"/>
|
||||
<constraint firstItem="WiD-pa-sbk" firstAttribute="leading" secondItem="CNB-oc-kaO" secondAttribute="leading" constant="16" id="HaM-Sd-kdC"/>
|
||||
<constraint firstItem="WiD-pa-sbk" firstAttribute="top" secondItem="CNB-oc-kaO" secondAttribute="top" constant="14" id="jqj-Av-mKc"/>
|
||||
<constraint firstAttribute="trailing" secondItem="WiD-pa-sbk" secondAttribute="trailing" constant="16" id="tZs-9c-MbL"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lhV-Mj-Sw9">
|
||||
<rect key="frame" x="0.0" y="0.0" width="319" height="48"/>
|
||||
<color key="backgroundColor" white="0.50510204081632648" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="lhV-Mj-Sw9" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="0eY-Lc-5V5"/>
|
||||
<constraint firstAttribute="bottom" secondItem="CNB-oc-kaO" secondAttribute="bottom" id="BgC-GA-kbQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="lhV-Mj-Sw9" secondAttribute="trailing" id="MuO-rT-Ae0"/>
|
||||
<constraint firstAttribute="bottom" secondItem="lhV-Mj-Sw9" secondAttribute="bottom" id="OMj-0f-YDG"/>
|
||||
<constraint firstItem="CNB-oc-kaO" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="OPc-SQ-Ez8"/>
|
||||
<constraint firstItem="lhV-Mj-Sw9" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="TPe-O6-dMN"/>
|
||||
<constraint firstItem="CNB-oc-kaO" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="nhU-hV-Qt8"/>
|
||||
<constraint firstAttribute="trailing" secondItem="CNB-oc-kaO" secondAttribute="trailing" id="rb0-vP-lzN"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="hiddenSwitch" destination="iTv-d4-ayC" id="RUB-mq-6va"/>
|
||||
<outlet property="selectedView" destination="lhV-Mj-Sw9" id="T42-ff-HUj"/>
|
||||
<outlet property="titleLabel" destination="WiD-pa-sbk" id="ooM-bp-mO6"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="82.400000000000006" y="111.54422788605699"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class MapsRouteCellItem: TableAdapterItem {
|
||||
|
||||
init(darkStyle: Bool = false,
|
||||
title: String? = nil,
|
||||
subtitle: String? = nil,
|
||||
separator: Bool = true,
|
||||
selected: Bool = false) {
|
||||
|
||||
let cellData = MapsRouteCellData(title ?? "42 мин",
|
||||
subtitle ?? "улица Поляны\nСамый быстрый",
|
||||
darkStyle,
|
||||
separator,
|
||||
selected)
|
||||
|
||||
super.init(cellClass: MapsRouteCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class MapsRouteCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String
|
||||
var subtitle: String
|
||||
var darkStyle: Bool
|
||||
var separator: Bool
|
||||
var selected: Bool
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String,
|
||||
_ subtitle: String,
|
||||
_ darkStyle: Bool,
|
||||
_ separator: Bool,
|
||||
_ selected: Bool) {
|
||||
|
||||
self.title = title
|
||||
self.subtitle = subtitle
|
||||
self.darkStyle = darkStyle
|
||||
self.separator = separator
|
||||
self.selected = selected
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
class func height() -> CGFloat {
|
||||
return (ContainerDevice.isIphoneX ? 164.0 : 135.0)
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return MapsRouteCellData.height()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class MapsRouteCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsRouteCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var mainView: UIView?
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet private weak var textLabel2: UILabel?
|
||||
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? MapsRouteCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.textColor = data.darkStyle ? .white : .black
|
||||
titleLabel?.text = data.title
|
||||
|
||||
textLabel2?.text = data.subtitle
|
||||
|
||||
mainView?.backgroundColor = data.selected ? Colors.rgba(155, 155, 155, 0.1) : .clear /// UIColor.black.withAlphaComponent(0.03) : .clear
|
||||
|
||||
if data.separator {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 16.0, bottom: 0.0, right: 0.0)
|
||||
} else {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
<?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="MapsRouteCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="134"/>
|
||||
<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="320" height="134"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Dun-dQ-uTM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="134"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pBn-rm-92X">
|
||||
<rect key="frame" x="238" y="36" width="67" height="64"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5ur-xE-QDQ" customClass="DesignButton" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="67" height="64"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="19"/>
|
||||
<state key="normal" title="GO">
|
||||
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</state>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.29803922770000002" green="0.85098040100000005" blue="0.39215686919999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="13"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="hideAnimation" value="NO"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="5ur-xE-QDQ" secondAttribute="bottom" id="5F0-Tm-Trz"/>
|
||||
<constraint firstAttribute="trailing" secondItem="5ur-xE-QDQ" secondAttribute="trailing" id="8ju-rI-kzS"/>
|
||||
<constraint firstItem="5ur-xE-QDQ" firstAttribute="leading" secondItem="pBn-rm-92X" secondAttribute="leading" id="Hrs-18-lRE"/>
|
||||
<constraint firstAttribute="width" constant="67" id="TjD-E0-PxD"/>
|
||||
<constraint firstItem="5ur-xE-QDQ" firstAttribute="top" secondItem="pBn-rm-92X" secondAttribute="top" id="iYf-Xq-h5d"/>
|
||||
<constraint firstAttribute="height" constant="64" id="sQc-zM-O67"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="42 min" lineBreakMode="tailTruncation" numberOfLines="100" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bsa-cw-K0A">
|
||||
<rect key="frame" x="15" y="36" width="59.5" height="21.5"/>
|
||||
<fontDescription key="fontDescription" type="boldSystem" pointSize="18"/>
|
||||
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="100" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9of-PK-HS6">
|
||||
<rect key="frame" x="15" y="57" width="208" height="49"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="49" id="KP5-SK-BpH"/>
|
||||
</constraints>
|
||||
<attributedString key="attributedText">
|
||||
<fragment content="28 km street ..
Fast">
|
||||
<attributes>
|
||||
<color key="NSColor" red="0.625" green="0.625" blue="0.625" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<font key="NSFont" size="15" name=".AppleSystemUIFont"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="left" lineBreakMode="wordWrapping" baseWritingDirection="natural" lineHeightMultiple="1.2" tighteningFactorForTruncation="0.0"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
</attributedString>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="9of-PK-HS6" firstAttribute="leading" secondItem="Dun-dQ-uTM" secondAttribute="leading" constant="15" id="Jpq-R9-al3"/>
|
||||
<constraint firstItem="bsa-cw-K0A" firstAttribute="leading" secondItem="Dun-dQ-uTM" secondAttribute="leading" constant="15" id="Ksb-OA-EPO"/>
|
||||
<constraint firstItem="bsa-cw-K0A" firstAttribute="centerY" secondItem="Dun-dQ-uTM" secondAttribute="centerY" constant="-20.25" id="SPV-as-WgW"/>
|
||||
<constraint firstItem="9of-PK-HS6" firstAttribute="centerY" secondItem="Dun-dQ-uTM" secondAttribute="centerY" constant="14.5" id="bp9-Wn-mdU"/>
|
||||
<constraint firstItem="pBn-rm-92X" firstAttribute="leading" secondItem="9of-PK-HS6" secondAttribute="trailing" constant="15" id="dZm-f1-u6l"/>
|
||||
<constraint firstAttribute="trailing" secondItem="pBn-rm-92X" secondAttribute="trailing" constant="15" id="fWc-dJ-BnO"/>
|
||||
<constraint firstItem="pBn-rm-92X" firstAttribute="centerY" secondItem="Dun-dQ-uTM" secondAttribute="centerY" constant="1" id="jf6-gf-C8I"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="h9I-CO-sJD" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="134"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.5" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
|
||||
<color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="size" keyPath="shadowOffset">
|
||||
<size key="value" width="0.0" height="0.0"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowOpacity">
|
||||
<real key="value" value="10"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowRadius">
|
||||
<real key="value" value="3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="h9I-CO-sJD" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="4nJ-nb-4UJ"/>
|
||||
<constraint firstItem="h9I-CO-sJD" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="B7o-RX-aA5"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Dun-dQ-uTM" secondAttribute="trailing" id="L5f-aZ-fyU"/>
|
||||
<constraint firstItem="Dun-dQ-uTM" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="Qb1-oa-fcQ"/>
|
||||
<constraint firstItem="Dun-dQ-uTM" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="aen-ed-Rir"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Dun-dQ-uTM" secondAttribute="bottom" id="lkU-Yb-uWB"/>
|
||||
<constraint firstAttribute="bottom" secondItem="h9I-CO-sJD" secondAttribute="bottom" id="uLG-qt-qIA"/>
|
||||
<constraint firstAttribute="trailing" secondItem="h9I-CO-sJD" secondAttribute="trailing" id="vOX-Ub-9GQ"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="mainView" destination="Dun-dQ-uTM" id="n9e-QW-8mU"/>
|
||||
<outlet property="selectedView" destination="h9I-CO-sJD" id="olF-go-Ndz"/>
|
||||
<outlet property="textLabel2" destination="9of-PK-HS6" id="TBa-hN-8Of"/>
|
||||
<outlet property="titleLabel" destination="bsa-cw-K0A" id="xlu-I1-k5c"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="126.40000000000001" y="110.64467766116942"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
// MARK: - Item
|
||||
|
||||
class MapsSearchCellItem: TableAdapterItem {
|
||||
|
||||
init(darkStyle: Bool = false,
|
||||
title: String? = nil,
|
||||
color: UIColor? = nil,
|
||||
separator: Bool = true) {
|
||||
|
||||
let cellData = MapsSearchCellData(title ?? "",
|
||||
color ?? UIColor.systemBlue,
|
||||
darkStyle,
|
||||
separator)
|
||||
|
||||
super.init(cellClass: MapsSearchCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Data
|
||||
|
||||
class MapsSearchCellData: TableAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
var title: String
|
||||
var color: UIColor
|
||||
var darkStyle: Bool
|
||||
var separator: Bool
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
init(_ title: String,
|
||||
_ color: UIColor,
|
||||
_ darkStyle: Bool,
|
||||
_ separator: Bool) {
|
||||
|
||||
self.title = title
|
||||
self.color = color
|
||||
self.darkStyle = darkStyle
|
||||
self.separator = separator
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func cellHeight() -> CGFloat {
|
||||
return 59
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Cell
|
||||
|
||||
class MapsSearchCell: TableAdapterCell {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsSearchCellData?
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet override var selectedView: UIView? {
|
||||
didSet { }
|
||||
}
|
||||
|
||||
@IBOutlet private weak var titleLabel: UILabel?
|
||||
@IBOutlet weak var colorView: DesignView!
|
||||
|
||||
// MARK: Initialize
|
||||
|
||||
override func fill(data: TableAdapterCellData?) {
|
||||
guard let data = data as? MapsSearchCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.textColor = data.darkStyle ? .white : .black
|
||||
|
||||
titleLabel?.text = data.title
|
||||
colorView.fillColor = data.color
|
||||
|
||||
|
||||
if data.separator {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 16.0, bottom: 0.0, right: 0.0)
|
||||
} else {
|
||||
separatorInset = UIEdgeInsets(top: 0.0, left: 0.0, bottom: 0.0, right: CGFloat(Double.greatestFiniteMagnitude))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+113
@@ -0,0 +1,113 @@
|
||||
<?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="MapsSearchCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="59"/>
|
||||
<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="320" height="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="L1O-ub-wLf">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="59"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ECG-Pb-3nr" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="15" y="15" width="30" height="30"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="hand.thumbsup" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="N07-FN-JPo">
|
||||
<rect key="frame" x="7" y="6.5" width="16" height="16"/>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="16" id="TBq-Dl-xhj"/>
|
||||
<constraint firstAttribute="height" constant="15" id="rqk-d7-9d6"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="30" id="5uE-Br-51f"/>
|
||||
<constraint firstItem="N07-FN-JPo" firstAttribute="centerX" secondItem="ECG-Pb-3nr" secondAttribute="centerX" id="dOi-NQ-u0T"/>
|
||||
<constraint firstItem="N07-FN-JPo" firstAttribute="centerY" secondItem="ECG-Pb-3nr" secondAttribute="centerY" id="qw3-4Q-OAk"/>
|
||||
<constraint firstAttribute="width" constant="30" id="z4N-oz-WUI"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.97254902119999997" green="0.58431375029999999" blue="0.25098040700000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="15"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Store" lineBreakMode="tailTruncation" numberOfLines="100" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="DTU-6t-wOi">
|
||||
<rect key="frame" x="54" y="0.0" width="250" height="59"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="59" id="0Fn-nu-q1l"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="20"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="DTU-6t-wOi" secondAttribute="trailing" constant="16" id="6No-xU-dao"/>
|
||||
<constraint firstItem="ECG-Pb-3nr" firstAttribute="leading" secondItem="L1O-ub-wLf" secondAttribute="leading" constant="15" id="IKl-Ye-E1x"/>
|
||||
<constraint firstItem="ECG-Pb-3nr" firstAttribute="top" secondItem="L1O-ub-wLf" secondAttribute="top" constant="15" id="gMg-c4-Pkz"/>
|
||||
<constraint firstItem="DTU-6t-wOi" firstAttribute="leading" secondItem="ECG-Pb-3nr" secondAttribute="trailing" constant="9" id="xli-dc-Zwd"/>
|
||||
<constraint firstItem="DTU-6t-wOi" firstAttribute="top" secondItem="L1O-ub-wLf" secondAttribute="top" id="yff-8E-zCL"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view alpha="0.0" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wV2-E2-RAh" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="59"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.5" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
|
||||
<color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="size" keyPath="shadowOffset">
|
||||
<size key="value" width="0.0" height="0.0"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowOpacity">
|
||||
<real key="value" value="10"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowRadius">
|
||||
<real key="value" value="3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="wV2-E2-RAh" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="1F5-y8-jJJ"/>
|
||||
<constraint firstItem="L1O-ub-wLf" firstAttribute="top" secondItem="Qrk-n6-aPT" secondAttribute="top" id="8tn-cY-OR5"/>
|
||||
<constraint firstItem="L1O-ub-wLf" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="CZk-k7-ySI"/>
|
||||
<constraint firstAttribute="trailing" secondItem="L1O-ub-wLf" secondAttribute="trailing" id="Dj2-w8-Qgw"/>
|
||||
<constraint firstAttribute="bottom" secondItem="wV2-E2-RAh" secondAttribute="bottom" id="dFO-k8-zt8"/>
|
||||
<constraint firstAttribute="trailing" secondItem="wV2-E2-RAh" secondAttribute="trailing" id="eA9-Et-Zet"/>
|
||||
<constraint firstAttribute="bottom" secondItem="L1O-ub-wLf" secondAttribute="bottom" id="lcx-9F-ZU7"/>
|
||||
<constraint firstItem="wV2-E2-RAh" firstAttribute="leading" secondItem="Qrk-n6-aPT" secondAttribute="leading" id="vJP-Fk-OkD"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<connections>
|
||||
<outlet property="colorView" destination="ECG-Pb-3nr" id="38a-gJ-LHL"/>
|
||||
<outlet property="selectedView" destination="wV2-E2-RAh" id="4Mz-zy-z4a"/>
|
||||
<outlet property="titleLabel" destination="DTU-6t-wOi" id="DC6-89-Ep4"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="126.40000000000001" y="111.0944527736132"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="hand.thumbsup" catalog="system" width="64" height="64"/>
|
||||
</resources>
|
||||
</document>
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
|
||||
|
||||
|
||||
import UIKit
|
||||
import ContainerControllerSwift
|
||||
|
||||
|
||||
enum MapsFavoriteColorType {
|
||||
case blue // 0 174 239
|
||||
case brown // 173 120 85
|
||||
case red // 255 92 71
|
||||
case orange // Colors.rgb(248, 149, 64)
|
||||
case yellow // : UIColor = Colors.rgb(255, 179, 0)
|
||||
case gray // 118 118 128 15%
|
||||
}
|
||||
|
||||
class MapsFavoriteItem: CollectionAdapterItem {
|
||||
|
||||
init(title: String? = nil,
|
||||
subtitle: String? = nil,
|
||||
colorType: MapsFavoriteColorType,
|
||||
image: UIImage? = nil,
|
||||
darkStyle: Bool = false,
|
||||
clickCallback: (() -> Void)? = nil) {
|
||||
|
||||
let cellData = MapsFavoriteCellData(title, subtitle, colorType, image, darkStyle, clickCallback)
|
||||
|
||||
super.init(cellClass: MapsFavoriteCell.self, cellData: cellData)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MapsFavoriteCellData: CollectionAdapterCellData {
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public let title: String
|
||||
public let subTitle: String
|
||||
public let colorType: MapsFavoriteColorType
|
||||
public let image: UIImage?
|
||||
public let darkStyle: Bool
|
||||
public var clickCallback: (() -> Void)?
|
||||
|
||||
// MARK: Inits
|
||||
|
||||
public init (_ title: String?,
|
||||
_ subTitle: String?,
|
||||
_ colorType: MapsFavoriteColorType,
|
||||
_ image: UIImage?,
|
||||
_ darkStyle: Bool,
|
||||
_ clickCallback: (() -> Void)?) {
|
||||
|
||||
self.title = title ?? ""
|
||||
self.subTitle = subTitle ?? ""
|
||||
self.colorType = colorType
|
||||
self.image = image
|
||||
self.darkStyle = darkStyle
|
||||
self.clickCallback = clickCallback
|
||||
|
||||
super.init()
|
||||
}
|
||||
|
||||
override public func size() -> CGSize {
|
||||
return CGSize(width: 86, height: 137)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class MapsFavoriteCell: CollectionAdapterCell {
|
||||
|
||||
// MARK: Outlets
|
||||
|
||||
@IBOutlet weak var imageButton: DesignButton?
|
||||
@IBOutlet weak var titleLabel: UILabel?
|
||||
@IBOutlet weak var subtitleLabel: UILabel?
|
||||
|
||||
// MARK: Properties
|
||||
|
||||
public var data: MapsFavoriteCellData?
|
||||
|
||||
override func awakeFromNib() {
|
||||
|
||||
}
|
||||
|
||||
override func fill(data: Any?) {
|
||||
|
||||
guard let data = data as? MapsFavoriteCellData else { return }
|
||||
self.data = data
|
||||
|
||||
titleLabel?.textColor = data.darkStyle ? .white : .black
|
||||
|
||||
titleLabel?.text = data.title
|
||||
subtitleLabel?.text = data.subTitle
|
||||
|
||||
if let image = data.image {
|
||||
imageButton?.setImage(image, for: .normal)
|
||||
}
|
||||
|
||||
var color: UIColor
|
||||
|
||||
switch data.colorType {
|
||||
case .blue: color = Colors.rgb(0, 174, 239)
|
||||
case .red: color = Colors.rgb(255, 92, 71)
|
||||
case .brown: color = Colors.rgb(173, 120, 85)
|
||||
case .orange: color = Colors.rgb(248, 149, 64)
|
||||
case .yellow: color = Colors.rgb(255, 179, 0)
|
||||
case .gray: color = Colors.rgba(155, 155, 155, 0.2)
|
||||
}
|
||||
|
||||
if data.colorType == .gray {
|
||||
imageButton?.tintColor = .systemBlue
|
||||
} else {
|
||||
imageButton?.tintColor = .white
|
||||
}
|
||||
|
||||
imageButton?.layer.backgroundColor = color.cgColor
|
||||
imageButton?.fillColor = color
|
||||
}
|
||||
|
||||
@IBAction func buttonClickAction(_ sender: Any) {
|
||||
data?.clickCallback?()
|
||||
}
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
<?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="MapsFavoriteCell" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="86" height="137"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
|
||||
<rect key="frame" x="0.0" y="0.0" width="86" height="137"/>
|
||||
<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="86" height="137"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gSI-Iw-oJa" customClass="DesignButton" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="13" y="9" width="60" height="60"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="60" id="CqI-gj-AsC"/>
|
||||
<constraint firstAttribute="width" constant="60" id="eyA-xh-juC"/>
|
||||
</constraints>
|
||||
<color key="tintColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<state key="normal" image="house.fill" catalog="system"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="-1"/>
|
||||
</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>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Home" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dEe-gI-KIe">
|
||||
<rect key="frame" x="0.0" y="77" width="86" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Add" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TRG-4Z-hEG">
|
||||
<rect key="frame" x="0.0" y="98" width="86" height="14.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="dEe-gI-KIe" firstAttribute="top" secondItem="gSI-Iw-oJa" secondAttribute="bottom" constant="8" id="2LK-Qw-cYT"/>
|
||||
<constraint firstAttribute="trailing" secondItem="TRG-4Z-hEG" secondAttribute="trailing" id="2ps-qQ-BCO"/>
|
||||
<constraint firstItem="gSI-Iw-oJa" firstAttribute="centerX" secondItem="LEH-bq-86c" secondAttribute="centerX" id="6AF-VK-6OI"/>
|
||||
<constraint firstItem="dEe-gI-KIe" firstAttribute="leading" secondItem="LEH-bq-86c" secondAttribute="leading" id="Y95-sq-vfL"/>
|
||||
<constraint firstItem="TRG-4Z-hEG" firstAttribute="top" secondItem="dEe-gI-KIe" secondAttribute="bottom" constant="3" id="sxZ-lw-6T7"/>
|
||||
<constraint firstItem="TRG-4Z-hEG" firstAttribute="leading" secondItem="LEH-bq-86c" secondAttribute="leading" id="vBj-xt-H9c"/>
|
||||
<constraint firstItem="gSI-Iw-oJa" firstAttribute="top" secondItem="LEH-bq-86c" secondAttribute="top" constant="9" id="x4f-qZ-COE"/>
|
||||
<constraint firstAttribute="trailing" secondItem="dEe-gI-KIe" secondAttribute="trailing" id="zJB-Fs-WKl"/>
|
||||
</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"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="boolean" keyPath="hideAnimation" value="NO"/>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<connections>
|
||||
<outlet property="imageButton" destination="gSI-Iw-oJa" id="qP3-Hl-7ap"/>
|
||||
<outlet property="subtitleLabel" destination="TRG-4Z-hEG" id="gJE-Hc-BCC"/>
|
||||
<outlet property="titleLabel" destination="dEe-gI-KIe" id="XDV-ww-X7B"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="131.8840579710145" y="87.723214285714278"/>
|
||||
</collectionViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="house.fill" catalog="system" width="64" height="52"/>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// TripsDayEmptyView.swift
|
||||
// GTDriver
|
||||
//
|
||||
// Created by mrustaa on 16/01/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class MapsButtons: XibView {
|
||||
|
||||
// MARK: - IBOutlets
|
||||
|
||||
@IBOutlet weak var buttonMenu: UIButton!
|
||||
@IBOutlet weak var buttonLocation: UIButton!
|
||||
|
||||
@IBOutlet weak var mainView: DesignView!
|
||||
var visualEffectView: UIVisualEffectView?
|
||||
|
||||
var buttonsActionCallback: ((_ index: Int) -> Void)?
|
||||
|
||||
override func loadedFromNib() {
|
||||
backgroundColor = .clear
|
||||
}
|
||||
|
||||
// MARK: - IBAction
|
||||
|
||||
public func changeButtonLocation(fill: Bool) {
|
||||
let sysName = fill ? "location.fill" : "location"
|
||||
buttonLocation.setImage(UIImage(systemName: sysName), for: .normal)
|
||||
}
|
||||
|
||||
@IBAction func buttonInfoAction(_ sender: UIButton) {
|
||||
if let buttonsActionCallback = buttonsActionCallback {
|
||||
return buttonsActionCallback(0)
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func buttonLocationAction(_ sender: UIButton) {
|
||||
if let buttonsActionCallback = buttonsActionCallback {
|
||||
return buttonsActionCallback(1)
|
||||
}
|
||||
}
|
||||
|
||||
func addBlur(darkStyle: Bool) {
|
||||
let style: UIBlurEffect.Style = darkStyle ? .systemThinMaterialDark : .systemChromeMaterialLight
|
||||
|
||||
buttonMenu.tintColor = darkStyle ? .white : .systemBlue
|
||||
buttonLocation.tintColor = darkStyle ? .white : .systemBlue
|
||||
|
||||
mainView.fillColor = .clear
|
||||
|
||||
if visualEffectView == nil {
|
||||
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: style))
|
||||
mainView.insertSubview(blurView, at: 0)
|
||||
visualEffectView = blurView
|
||||
}
|
||||
|
||||
visualEffectView?.effect = UIBlurEffect(style: style)
|
||||
visualEffectView?.bounds = bounds
|
||||
visualEffectView?.x = 0
|
||||
visualEffectView?.y = 0
|
||||
visualEffectView?.layer.cornerRadius = 8.0
|
||||
visualEffectView?.layer.masksToBounds = true
|
||||
visualEffectView?.autoresizingMask = [.flexibleLeftMargin, .flexibleWidth, .flexibleRightMargin, .flexibleTopMargin, .flexibleHeight, .flexibleBottomMargin]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
<?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="MapsButtons" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="buttonLocation" destination="9Mm-as-dAI" id="fHl-0s-gB3"/>
|
||||
<outlet property="buttonMenu" destination="2Re-wl-lXF" id="wlG-CZ-ZEk"/>
|
||||
<outlet property="mainView" destination="odA-SN-ic1" id="VZP-G8-aFg"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eiX-vg-4Th">
|
||||
<rect key="frame" x="0.0" y="0.0" width="45" height="91"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="odA-SN-ic1" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="45" height="91"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2Re-wl-lXF">
|
||||
<rect key="frame" x="0.0" y="0.0" width="45" height="45"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" image="info.circle" catalog="system"/>
|
||||
<connections>
|
||||
<action selector="buttonInfoAction:" destination="-1" eventType="touchUpInside" id="z4I-lA-L0G"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9Mm-as-dAI">
|
||||
<rect key="frame" x="0.0" y="46" width="45" height="45"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<state key="normal" image="location" catalog="system"/>
|
||||
<connections>
|
||||
<action selector="buttonLocationAction:" destination="-1" eventType="touchUpInside" id="yYZ-Hw-UcF"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="8"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
|
||||
<real key="value" value="0.5"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
|
||||
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.20000000000000001" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowOpacity">
|
||||
<real key="value" value="2"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="shadowRadius">
|
||||
<real key="value" value="3"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="shadowColor">
|
||||
<color key="value" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="JAR-Am-Qql" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="45.5" width="45" height="0.5"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.20000000298023224" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
<point key="canvasLocation" x="312.80000000000001" y="119.1904047976012"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="info.circle" catalog="system" width="64" height="60"/>
|
||||
<image name="location" catalog="system" width="64" height="56"/>
|
||||
</resources>
|
||||
</document>
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// TripsDayEmptyView.swift
|
||||
// GTDriver
|
||||
//
|
||||
// Created by mrustaa on 16/01/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class MapsWeatherView: XibView {
|
||||
|
||||
// MARK: - IBOutlets
|
||||
|
||||
@IBOutlet weak var mainView: DesignView!
|
||||
var visualEffectView: UIVisualEffectView?
|
||||
@IBOutlet weak var textLabel: UILabel!
|
||||
|
||||
override func loadedFromNib() {
|
||||
backgroundColor = .clear
|
||||
mainView.fillColor = .clear
|
||||
}
|
||||
|
||||
public func addBlur(darkStyle: Bool) {
|
||||
let style: UIBlurEffect.Style = darkStyle ? .systemThinMaterialDark : .systemChromeMaterialLight
|
||||
|
||||
textLabel.textColor = darkStyle ? .white : .black
|
||||
|
||||
mainView.fillColor = .clear
|
||||
|
||||
if visualEffectView == nil {
|
||||
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: style))
|
||||
mainView.insertSubview(blurView, at: 0)
|
||||
visualEffectView = blurView
|
||||
}
|
||||
|
||||
visualEffectView?.effect = UIBlurEffect(style: style)
|
||||
visualEffectView?.bounds = bounds
|
||||
visualEffectView?.x = 0
|
||||
visualEffectView?.y = 0
|
||||
visualEffectView?.layer.cornerRadius = 6.0
|
||||
visualEffectView?.layer.masksToBounds = true
|
||||
visualEffectView?.autoresizingMask = [.flexibleLeftMargin, .flexibleWidth, .flexibleRightMargin, .flexibleTopMargin, .flexibleHeight, .flexibleBottomMargin]
|
||||
}
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
<?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="MapsWeatherView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="mainView" destination="FyJ-7L-vgu" id="l1E-Iq-1QQ"/>
|
||||
<outlet property="textLabel" destination="Out-BO-xeF" id="lzo-vU-Ieh"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view clipsSubviews="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ltI-Wt-r3w">
|
||||
<rect key="frame" x="0.0" y="0.0" width="58" height="27"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FyJ-7L-vgu" customClass="DesignView" customModule="PatternsSwift" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="58" height="27"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="6"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="16°" lineBreakMode="tailTruncation" numberOfLines="100" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Out-BO-xeF">
|
||||
<rect key="frame" x="26" y="2" width="33" height="24"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="20"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TrB-eA-HV8">
|
||||
<rect key="frame" x="2" y="2" width="23" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<color key="tintColor" systemColor="systemYellowColor" red="1" green="0.80000000000000004" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<state key="normal" image="sun.max.fill" catalog="system"/>
|
||||
</button>
|
||||
</subviews>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<point key="canvasLocation" x="124.8" y="151.57421289355324"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="sun.max.fill" catalog="system" width="64" height="62"/>
|
||||
</resources>
|
||||
</document>
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// HeaderLocationDetailsView.swift
|
||||
// GTDriver
|
||||
//
|
||||
// Created by mrustaa on 16/01/2020.
|
||||
// Copyright © 2020 mrustaa. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
|
||||
class HeaderDetailsView: XibView {
|
||||
|
||||
var buttonCloseClickCallback: (() -> Void)?
|
||||
|
||||
// MARK: - IBOutlets
|
||||
|
||||
@IBOutlet public weak var separatorView: UIView?
|
||||
@IBOutlet weak var separatorHeight: NSLayoutConstraint?
|
||||
|
||||
@IBOutlet weak var titleLabel: UILabel!
|
||||
@IBOutlet weak var subtitle: UILabel!
|
||||
@IBOutlet weak var textButton: UIButton!
|
||||
|
||||
override func loadedFromNib() {
|
||||
separatorHeight?.constant = 0.5
|
||||
separatorView?.alpha = 0.0
|
||||
|
||||
titleLabel.text = ""
|
||||
subtitle.text = ""
|
||||
textButton.setTitle("", for: .normal)
|
||||
}
|
||||
|
||||
func add(darkStyle: Bool) {
|
||||
titleLabel.textColor = darkStyle ? .white : .black
|
||||
subtitle.textColor = darkStyle ? .white : .black
|
||||
}
|
||||
|
||||
@IBAction func buttonCloseAction(_ sender: Any) {
|
||||
buttonCloseClickCallback?()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
<?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="HeaderLocationDetailsView" customModule="ContainerController" customModuleProvider="target">
|
||||
<connections>
|
||||
<outlet property="separatorHeight" destination="XeQ-S6-epL" id="RJb-Cx-wsu"/>
|
||||
<outlet property="separatorView" destination="qyU-mN-CPZ" id="Wam-cL-7Cl"/>
|
||||
<outlet property="subtitle" destination="SiU-4U-nQ2" id="exu-e7-sTw"/>
|
||||
<outlet property="textButton" destination="dHI-g8-o5W" id="2mD-PI-DBt"/>
|
||||
<outlet property="titleLabel" destination="rP7-kq-NRc" id="iTd-Ph-pt4"/>
|
||||
</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="78"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kEq-BX-n4L" customClass="DesignView" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="78"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="zoq-mq-Oj6" 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="7sy-vP-zdU"/>
|
||||
<constraint firstAttribute="width" constant="36" id="HOA-Ga-fAN"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="-1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.5" alpha="0.40128082482993199" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Marked Location" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rP7-kq-NRc">
|
||||
<rect key="frame" x="16" y="19" width="242" height="21"/>
|
||||
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="From:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SiU-4U-nQ2">
|
||||
<rect key="frame" x="16" y="42" width="39.5" height="18"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dHI-g8-o5W">
|
||||
<rect key="frame" x="59" y="42" width="84" height="18"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="18" id="PDW-6h-vmb"/>
|
||||
</constraints>
|
||||
<state key="normal" title="My Location"/>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gOR-GM-J5G" customClass="DesignView" customModule="ContainerController" customModuleProvider="target">
|
||||
<rect key="frame" x="274" y="17" width="29" height="29"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Kpw-f1-JZ2">
|
||||
<rect key="frame" x="0.0" y="0.0" width="29" height="29"/>
|
||||
<color key="tintColor" white="0.5" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<inset key="imageEdgeInsets" minX="6.5" minY="7.7999999999999998" maxX="6.5" maxY="7"/>
|
||||
<state key="normal" image="xmark" catalog="system">
|
||||
<preferredSymbolConfiguration key="preferredSymbolConfiguration" weight="bold"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="buttonCloseAction:" destination="-1" eventType="touchUpInside" id="3gE-jv-dQQ"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="Kpw-f1-JZ2" firstAttribute="top" secondItem="gOR-GM-J5G" secondAttribute="top" id="CZU-IP-iDH"/>
|
||||
<constraint firstItem="Kpw-f1-JZ2" firstAttribute="leading" secondItem="gOR-GM-J5G" secondAttribute="leading" id="Fsl-xH-GkP"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Kpw-f1-JZ2" secondAttribute="trailing" id="epa-DN-J1E"/>
|
||||
<constraint firstAttribute="bottom" secondItem="Kpw-f1-JZ2" secondAttribute="bottom" id="oYd-ha-YHv"/>
|
||||
<constraint firstAttribute="height" constant="29" id="vJP-aZ-3Qx"/>
|
||||
<constraint firstAttribute="width" constant="29" id="wob-gr-Ydu"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="-1"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.5" alpha="0.1499521683682313" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qyU-mN-CPZ">
|
||||
<rect key="frame" x="0.0" y="77" width="320" height="1"/>
|
||||
<color key="backgroundColor" white="0.5" alpha="0.59568983843537415" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="XeQ-S6-epL"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="gOR-GM-J5G" firstAttribute="top" secondItem="kEq-BX-n4L" secondAttribute="top" constant="17" id="14P-Fj-rxR"/>
|
||||
<constraint firstItem="SiU-4U-nQ2" firstAttribute="leading" secondItem="kEq-BX-n4L" secondAttribute="leading" constant="16" id="8cJ-0f-cbC"/>
|
||||
<constraint firstItem="SiU-4U-nQ2" firstAttribute="top" secondItem="rP7-kq-NRc" secondAttribute="bottom" constant="2" id="Emo-so-jls"/>
|
||||
<constraint firstItem="rP7-kq-NRc" firstAttribute="leading" secondItem="kEq-BX-n4L" secondAttribute="leading" constant="16" id="Jnk-S2-Se2"/>
|
||||
<constraint firstItem="rP7-kq-NRc" firstAttribute="top" secondItem="zoq-mq-Oj6" secondAttribute="bottom" constant="9" id="NDs-J9-lSh"/>
|
||||
<constraint firstItem="dHI-g8-o5W" firstAttribute="leading" secondItem="SiU-4U-nQ2" secondAttribute="trailing" constant="3.5" id="P3q-VJ-PDD"/>
|
||||
<constraint firstAttribute="trailing" secondItem="gOR-GM-J5G" secondAttribute="trailing" constant="17" id="QAS-FG-6MV"/>
|
||||
<constraint firstItem="zoq-mq-Oj6" firstAttribute="top" secondItem="kEq-BX-n4L" secondAttribute="top" constant="5" id="Uas-Sw-k9y"/>
|
||||
<constraint firstItem="qyU-mN-CPZ" firstAttribute="leading" secondItem="kEq-BX-n4L" secondAttribute="leading" id="Vxe-jp-YrR"/>
|
||||
<constraint firstItem="dHI-g8-o5W" firstAttribute="top" secondItem="rP7-kq-NRc" secondAttribute="bottom" constant="2" id="aQT-TH-Iys"/>
|
||||
<constraint firstAttribute="bottom" secondItem="qyU-mN-CPZ" secondAttribute="bottom" id="bQN-Ao-eW6"/>
|
||||
<constraint firstItem="zoq-mq-Oj6" firstAttribute="centerX" secondItem="kEq-BX-n4L" secondAttribute="centerX" id="eD6-zL-DXb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="qyU-mN-CPZ" secondAttribute="trailing" id="unH-0j-hec"/>
|
||||
<constraint firstAttribute="bottom" secondItem="qyU-mN-CPZ" secondAttribute="bottom" id="v0d-7f-Y45"/>
|
||||
<constraint firstItem="gOR-GM-J5G" firstAttribute="leading" secondItem="rP7-kq-NRc" secondAttribute="trailing" constant="16" id="ywP-y8-dc2"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="color" keyPath="fillColor">
|
||||
<color key="value" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
|
||||
<real key="value" value="10"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
<constraints>
|
||||
<constraint firstItem="kEq-BX-n4L" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="EZc-a0-fDU"/>
|
||||
<constraint firstAttribute="bottom" secondItem="kEq-BX-n4L" secondAttribute="bottom" id="Th6-e2-7Te"/>
|
||||
<constraint firstItem="kEq-BX-n4L" firstAttribute="trailing" secondItem="iN0-l3-epB" secondAttribute="trailing" id="VFf-Rn-CcY"/>
|
||||
<constraint firstAttribute="bottom" secondItem="kEq-BX-n4L" secondAttribute="bottom" id="mBj-MU-nkQ"/>
|
||||
<constraint firstItem="kEq-BX-n4L" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="z0r-kv-leF"/>
|
||||
</constraints>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<point key="canvasLocation" x="257.60000000000002" y="181.70914542728636"/>
|
||||
</view>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="xmark" catalog="system" width="64" height="56"/>
|
||||
</resources>
|
||||
</document>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user