Commit 928ba8cb by Daniel Dahan

development: updated access rights and renamed ControlView to ContentView

parent 05b19fa0
......@@ -32,7 +32,7 @@
96BCB7A41CB40DC500C806FE /* CaptureSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB75B1CB40DC500C806FE /* CaptureSession.swift */; };
96BCB7A51CB40DC500C806FE /* Capture.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB75C1CB40DC500C806FE /* Capture.swift */; };
96BCB7A61CB40DC500C806FE /* Card.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB75D1CB40DC500C806FE /* Card.swift */; };
96BCB7A71CB40DC500C806FE /* ControlView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB75E1CB40DC500C806FE /* ControlView.swift */; };
96BCB7A71CB40DC500C806FE /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB75E1CB40DC500C806FE /* ContentView.swift */; };
96BCB7A81CB40DC500C806FE /* FabButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB75F1CB40DC500C806FE /* FabButton.swift */; };
96BCB7A91CB40DC500C806FE /* FlatButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7601CB40DC500C806FE /* FlatButton.swift */; };
96BCB7AA1CB40DC500C806FE /* Grid.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BCB7611CB40DC500C806FE /* Grid.swift */; };
......@@ -133,7 +133,7 @@
96BCB8351CB4115200C806FE /* MaterialTextLayer.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB78A1CB40DC500C806FE /* MaterialTextLayer.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8361CB4115200C806FE /* Grid.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7611CB40DC500C806FE /* Grid.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8371CB4115200C806FE /* Layout.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7811CB40DC500C806FE /* Layout.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8381CB4115200C806FE /* ControlView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB75E1CB40DC500C806FE /* ControlView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8381CB4115200C806FE /* ContentView.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB75E1CB40DC500C806FE /* ContentView.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7951CB40DC500C806FE /* SearchBar.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7961CB40DC500C806FE /* SearchBarController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
96BCB83B1CB4115200C806FE /* NavigationDrawerController.swift in Headers */ = {isa = PBXBuildFile; fileRef = 96BCB7971CB40DC500C806FE /* NavigationDrawerController.swift */; settings = {ATTRIBUTES = (Public, ); }; };
......@@ -225,7 +225,7 @@
96BCB75B1CB40DC500C806FE /* CaptureSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaptureSession.swift; sourceTree = "<group>"; };
96BCB75C1CB40DC500C806FE /* Capture.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Capture.swift; sourceTree = "<group>"; };
96BCB75D1CB40DC500C806FE /* Card.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Card.swift; sourceTree = "<group>"; };
96BCB75E1CB40DC500C806FE /* ControlView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControlView.swift; sourceTree = "<group>"; };
96BCB75E1CB40DC500C806FE /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
96BCB75F1CB40DC500C806FE /* FabButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FabButton.swift; sourceTree = "<group>"; };
96BCB7601CB40DC500C806FE /* FlatButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FlatButton.swift; sourceTree = "<group>"; };
96BCB7611CB40DC500C806FE /* Grid.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Grid.swift; sourceTree = "<group>"; };
......@@ -342,6 +342,14 @@
name = Divider;
sourceTree = "<group>";
};
96264BE41D833C8400576F37 /* BarView */ = {
isa = PBXGroup;
children = (
96BCB7981CB40DC500C806FE /* BarView.swift */,
);
name = BarView;
sourceTree = "<group>";
};
962864601D5410FD00690B69 /* JSON */ = {
isa = PBXGroup;
children = (
......@@ -448,13 +456,12 @@
name = SearchBar;
sourceTree = "<group>";
};
963FBF061D669795008F8512 /* ControlView */ = {
963FBF061D669795008F8512 /* ContentView */ = {
isa = PBXGroup;
children = (
96BCB75E1CB40DC500C806FE /* ControlView.swift */,
96BCB7981CB40DC500C806FE /* BarView.swift */,
96BCB75E1CB40DC500C806FE /* ContentView.swift */,
);
name = ControlView;
name = ContentView;
sourceTree = "<group>";
};
9661222C1D3EC414008BB4CB /* macOS */ = {
......@@ -509,12 +516,13 @@
isa = PBXGroup;
children = (
96BCB8091CB4107700C806FE /* Animate */,
96264BE41D833C8400576F37 /* BarView */,
962DDD081D6FBBD0001C307C /* BottomTabBar */,
96BCB8031CB40F4B00C806FE /* Button */,
96BCB8021CB40F3B00C806FE /* Card */,
96BCB7FF1CB40EF000C806FE /* Capture */,
96BCB8051CB40F9C00C806FE /* Collection */,
963FBF061D669795008F8512 /* ControlView */,
963FBF061D669795008F8512 /* ContentView */,
96BCB8001CB40F0300C806FE /* Color */,
962A92581D42839100DBAF8E /* Data */,
96BCB80B1CB410CC00C806FE /* Device */,
......@@ -808,7 +816,7 @@
96BCB8351CB4115200C806FE /* MaterialTextLayer.swift in Headers */,
96BCB8361CB4115200C806FE /* Grid.swift in Headers */,
96BCB8371CB4115200C806FE /* Layout.swift in Headers */,
96BCB8381CB4115200C806FE /* ControlView.swift in Headers */,
96BCB8381CB4115200C806FE /* ContentView.swift in Headers */,
96BCB8391CB4115200C806FE /* SearchBar.swift in Headers */,
96BCB83A1CB4115200C806FE /* SearchBarController.swift in Headers */,
96BCB83B1CB4115200C806FE /* NavigationDrawerController.swift in Headers */,
......@@ -1101,7 +1109,7 @@
96BCB7D21CB40DC500C806FE /* TableViewCell.swift in Sources */,
96F1DC881D654FDF0025F925 /* Material+CALayer.swift in Sources */,
96BCB7B61CB40DC500C806FE /* Animation.swift in Sources */,
96BCB7A71CB40DC500C806FE /* ControlView.swift in Sources */,
96BCB7A71CB40DC500C806FE /* ContentView.swift in Sources */,
96BCB7DB1CB40DC500C806FE /* NavigationItem.swift in Sources */,
96BCB7E01CB40DC500C806FE /* NavigationDrawerController.swift in Sources */,
9628645F1D540AF300690B69 /* DynamicFontType.swift in Sources */,
......
......@@ -30,7 +30,7 @@
import UIKit
open class BarView: ControlView {
open class BarView: ContentView {
/// Divider layer.
open internal(set) var divider: Divider!
......
......@@ -42,7 +42,7 @@ open class Button: UIButton {
open private(set) lazy var visualLayer = CAShapeLayer()
/// An Array of pulse layers.
public private(set) lazy var pulseLayers = [CAShapeLayer]()
open private(set) lazy var pulseLayers = [CAShapeLayer]()
/// The opacity value for the pulse animation.
@IBInspectable
......
......@@ -221,19 +221,19 @@ open class Capture: View, UIGestureRecognizerDelegate {
}
/// A reference to the CapturePreview view.
open private(set) var previewView: CapturePreview!
open internal(set) var previewView: CapturePreview!
/// A reference to the CaptureSession.
open private(set) var captureSession: CaptureSession!
open internal(set) var captureSession: CaptureSession!
/// A reference to the focus layer used in focus animations.
open private(set) var focusLayer: Layer?
open internal(set) var focusLayer: Layer?
/// A reference to the exposure layer used in exposure animations.
open private(set) var exposureLayer: Layer?
open internal(set) var exposureLayer: Layer?
/// A reference to the reset layer used in reset animations.
open private(set) var resetLayer: Layer?
open internal(set) var resetLayer: Layer?
/// A reference to the cameraButton.
open var cameraButton: UIButton? {
......
......@@ -192,10 +192,10 @@ open class CaptureSession: NSObject, AVCaptureFileOutputRecordingDelegate {
internal var session: AVCaptureSession!
/// A boolean indicating if the session is running.
open private(set) var isRunning: Bool = false
open internal(set) var isRunning = false
/// A boolean indicating if the session is recording.
open private(set) var isRecording: Bool = false
open internal(set) var isRecording = false
/// A reference to the recorded time duration.
open var recordedDuration: CMTime {
......
......@@ -35,19 +35,19 @@ open class CollectionView: UICollectionView {
/// A preset wrapper around contentInset.
open var contentEdgeInsetsPreset: EdgeInsets {
get {
return (collectionViewLayout as? CollectionViewLayout)!.contentInset
return (collectionViewLayout as? CollectionViewLayout)!.contentEdgeInsets
}
set(value) {
(collectionViewLayout as? CollectionViewLayout)!.contentInset = value
(collectionViewLayout as? CollectionViewLayout)!.contentEdgeInsets = value
}
}
open override var contentInset: UIEdgeInsets {
get {
return (collectionViewLayout as? CollectionViewLayout)!.contentInset
return (collectionViewLayout as? CollectionViewLayout)!.contentEdgeInsets
}
set(value) {
(collectionViewLayout as? CollectionViewLayout)!.contentInset = value
(collectionViewLayout as? CollectionViewLayout)!.contentEdgeInsets = value
}
}
......
......@@ -37,27 +37,27 @@ open class CollectionViewLayout: UICollectionViewLayout {
/// The size of items.
open var itemSize = CGSize.zero
/// A preset wrapper around contentInset.
/// A preset wrapper around contentEdgeInsets.
open var contentEdgeInsetsPreset: EdgeInsetsPreset = .none {
didSet {
contentInset = EdgeInsetsPresetToValue(preset: contentEdgeInsetsPreset)
contentEdgeInsets = EdgeInsetsPresetToValue(preset: contentEdgeInsetsPreset)
}
}
/// A wrapper around grid.contentInset.
open var contentInset = EdgeInsets.zero
/// A wrapper around grid.contentEdgeInsets.
open var contentEdgeInsets = EdgeInsets.zero
/// Size of the content.
open private(set) var contentSize = CGSize.zero
open internal(set) var contentSize = CGSize.zero
/// Layout attribute items.
open private(set) var layoutItems = [(UICollectionViewLayoutAttributes, NSIndexPath)]()
open internal(set) lazy var layoutItems = [(UICollectionViewLayoutAttributes, NSIndexPath)]()
/// Cell data source items.
open private(set) var dataSourceItems: [DataSourceItem]?
open internal(set) var dataSourceItems: [DataSourceItem]?
/// Scroll direction.
open var scrollDirection: UICollectionViewScrollDirection = .vertical
open var scrollDirection = UICollectionViewScrollDirection.vertical
/// A preset wrapper around interimSpace.
open var interimSpacePreset = InterimSpacePreset.none {
......@@ -93,11 +93,11 @@ open class CollectionViewLayout: UICollectionViewLayout {
let item: DataSourceItem = dataSourceItems![indexPath.item]
if 0 < itemSize.width && 0 < itemSize.height {
attributes.frame = CGRect(x: offset.x, y: offset.y, width: itemSize.width - contentInset.left - contentInset.right, height: itemSize.height - contentInset.top - contentInset.bottom)
attributes.frame = CGRect(x: offset.x, y: offset.y, width: itemSize.width - contentEdgeInsets.left - contentEdgeInsets.right, height: itemSize.height - contentEdgeInsets.top - contentEdgeInsets.bottom)
} else if .vertical == scrollDirection {
attributes.frame = CGRect(x: contentInset.left, y: offset.y, width: collectionView!.bounds.width - contentInset.left - contentInset.right, height: item.height ?? collectionView!.bounds.height)
attributes.frame = CGRect(x: contentEdgeInsets.left, y: offset.y, width: collectionView!.bounds.width - contentEdgeInsets.left - contentEdgeInsets.right, height: item.height ?? collectionView!.bounds.height)
} else {
attributes.frame = CGRect(x: offset.x, y: contentInset.top, width: item.width ?? collectionView!.bounds.width, height: collectionView!.bounds.height - contentInset.top - contentInset.bottom)
attributes.frame = CGRect(x: offset.x, y: contentEdgeInsets.top, width: item.width ?? collectionView!.bounds.width, height: collectionView!.bounds.height - contentEdgeInsets.top - contentEdgeInsets.bottom)
}
return attributes
......@@ -131,8 +131,8 @@ open class CollectionViewLayout: UICollectionViewLayout {
self.dataSourceItems = dataSourceItems
layoutItems.removeAll()
offset.x = contentInset.left
offset.y = contentInset.top
offset.x = contentEdgeInsets.left
offset.y = contentEdgeInsets.top
for i in 0..<dataSourceItems.count {
let item: DataSourceItem = dataSourceItems[i]
......@@ -146,8 +146,8 @@ open class CollectionViewLayout: UICollectionViewLayout {
offset.y += nil == item.height ? itemSize.height : item.height!
}
offset.x += contentInset.right - interimSpace
offset.y += contentInset.bottom - interimSpace
offset.x += contentEdgeInsets.right - interimSpace
offset.y += contentEdgeInsets.bottom - interimSpace
if 0 < itemSize.width && 0 < itemSize.height {
contentSize = CGSize(width: offset.x, height: offset.y)
......
......@@ -36,7 +36,7 @@ public enum ContentViewAlignment: Int {
case center
}
open class ControlView: View {
open class ContentView: View {
/// Should center the contentView.
open var contentViewAlignment = ContentViewAlignment.any {
didSet {
......@@ -93,7 +93,8 @@ open class ControlView: View {
}
/// Grid cell factor.
@IBInspectable open var gridFactor: CGFloat = 24 {
@IBInspectable
open var gridFactor: CGFloat = 24 {
didSet {
assert(0 < gridFactor, "[Material Error: gridFactor must be greater than 0.]")
layoutSubviews()
......@@ -101,7 +102,7 @@ open class ControlView: View {
}
/// ContentView that holds the any desired subviews.
open private(set) lazy var contentView: UIView = UIView()
open private(set) lazy var contentView = UIView()
/// Left side UIControls.
open var leftControls = [UIView]() {
......@@ -196,6 +197,7 @@ open class ControlView: View {
}
contentView.grid.begin()
if .center == contentViewAlignment {
if lc < rc {
contentView.grid.columns = columns - 2 * rc
......
......@@ -46,11 +46,11 @@ public protocol MenuDelegate {
}
open class Menu: View {
/// A delegation reference.
open weak var delegate: MenuDelegate?
/// A Boolean that indicates if the menu is open or not.
open private(set) var isOpened = false
open internal(set) var isOpened = false
/// Enables the animations for the Menu.
open internal(set) var isEnabled = true
/// A preset wrapper around interimSpace.
open var interimSpacePreset = InterimSpacePreset.none {
......@@ -66,9 +66,6 @@ open class Menu: View {
}
}
/// Enables the animations for the Menu.
open private(set) var isEnabled = true
/// The direction in which the animation opens the menu.
open var direction = MenuDirection.up {
didSet {
......@@ -76,6 +73,9 @@ open class Menu: View {
}
}
/// A delegation reference.
open weak var delegate: MenuDelegate?
/// An Array of UIViews.
open var views = [UIView]() {
didSet {
......@@ -86,6 +86,7 @@ open class Menu: View {
for v in views {
addSubview(v)
}
reload()
}
}
......
......@@ -32,17 +32,17 @@ import UIKit
open class SearchBar: BarView {
/// The UITextField for the searchBar.
open private(set) var textField: UITextField!
open private(set) lazy var textField = UITextField()
/// Reference to the clearButton.
open private(set) var clearButton: IconButton!
/// Handle the clearButton manually.
@IBInspectable
open var clearButtonAutoHandleEnabled: Bool = true {
open var isClearButtonAutoHandleEnabled = true {
didSet {
clearButton.removeTarget(self, action: #selector(handleClearButton), for: .touchUpInside)
if clearButtonAutoHandleEnabled {
if isClearButtonAutoHandleEnabled {
clearButton.addTarget(self, action: #selector(handleClearButton), for: .touchUpInside)
}
}
......@@ -82,7 +82,7 @@ open class SearchBar: BarView {
/// Placeholder textColor.
@IBInspectable
open var placeholderColor: UIColor = Color.darkText.others {
open var placeholderColor = Color.darkText.others {
didSet {
if let v: String = placeholder {
textField.attributedPlaceholder = NSAttributedString(string: v, attributes: [NSForegroundColorAttributeName: placeholderColor])
......@@ -142,7 +142,7 @@ open class SearchBar: BarView {
/// Layout the clearButton.
open func layoutClearButton() {
let h: CGFloat = textField.frame.height
let h = textField.frame.height
clearButton.frame = CGRect(x: textField.frame.width - h, y: 0, width: h, height: h)
}
......@@ -154,7 +154,6 @@ open class SearchBar: BarView {
/// Prepares the textField.
private func prepareTextField() {
textField = UITextField()
textField.contentScaleFactor = Device.scale
textField.font = RobotoFont.regular(with: 17)
textField.backgroundColor = Color.clear
......@@ -169,7 +168,7 @@ open class SearchBar: BarView {
private func prepareClearButton() {
clearButton = IconButton(image: Icon.cm.close, tintColor: placeholderColor)
clearButton.contentEdgeInsets = .zero
clearButtonAutoHandleEnabled = true
isClearButtonAutoHandleEnabled = true
textField.clearButtonMode = .never
textField.rightViewMode = .whileEditing
textField.rightView = clearButton
......
......@@ -40,7 +40,7 @@ open class TextField: UITextField {
}
/// A Boolean that indicates if the TextField is in an animating state.
open private(set) var animating = false
open internal(set) var isAnimating = false
/// A property that accesses the backing layer's backgroundColor.
@IBInspectable
......@@ -199,7 +199,7 @@ open class TextField: UITextField {
/// Enables the clearIconButton.
@IBInspectable
open var enableClearIconButton: Bool {
open var isClearIconButtonEnable: Bool {
get {
return nil != clearIconButton
}
......@@ -234,7 +234,7 @@ open class TextField: UITextField {
/// Enables the visibilityIconButton.
@IBInspectable
open var enableVisibilityIconButton: Bool {
open var isVisibilityIconButtonEnable: Bool {
get {
return nil != visibilityIconButton
}
......@@ -379,7 +379,7 @@ open class TextField: UITextField {
/// Ensures that the components are sized correctly.
open func layoutToSize() {
if !animating {
if !isAnimating {
layoutPlaceholderLabel()
layoutDetailLabel()
layoutClearIconButton()
......@@ -461,7 +461,7 @@ open class TextField: UITextField {
/// The animation for the placeholder when editing begins.
open func placeholderEditingDidBeginAnimation() {
if placeholderLabel.transform.isIdentity {
animating = true
isAnimating = true
UIView.animate(withDuration: 0.15, animations: { [weak self] in
if let s = self {
s.placeholderLabel.transform = CGAffineTransform(scaleX: 0.75, y: 0.75)
......@@ -476,7 +476,7 @@ open class TextField: UITextField {
s.placeholderLabel.textColor = s.placeholderActiveColor
}
}) { [weak self] _ in
self?.animating = false
self?.isAnimating = false
}
} else if isEditing {
placeholderLabel.textColor = placeholderActiveColor
......@@ -486,7 +486,7 @@ open class TextField: UITextField {
/// The animation for the placeholder when editing ends.
open func placeholderEditingDidEndAnimation() {
if !placeholderLabel.transform.isIdentity && true == text?.isEmpty {
animating = true
isAnimating = true
UIView.animate(withDuration: 0.15, animations: { [weak self] in
if let s = self {
s.placeholderLabel.transform = CGAffineTransform.identity
......@@ -495,7 +495,7 @@ open class TextField: UITextField {
s.placeholderLabel.textColor = s.placeholderColor
}
}) { [weak self] _ in
self?.animating = false
self?.isAnimating = false
}
} else if !isEditing {
placeholderLabel.textColor = placeholderColor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment