Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Source/Cells/DataGridViewBaseCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import UIKit
*/
open class DataGridViewBaseCell: UICollectionViewCell {
/// The inset or outset margins for the rectangle around the cell’s text label.
open dynamic var textLabelInsets = UIEdgeInsets.zero
@objc open dynamic var textLabelInsets = UIEdgeInsets.zero
/// Background color for highlighted state.
open dynamic var highlightedBackgroundColor = UIColor(white: 0.9, alpha: 1)
@objc open dynamic var highlightedBackgroundColor = UIColor(white: 0.9, alpha: 1)
/// Background color for selected state.
open dynamic var selectedBackgroundColor = UIColor(white: 0.8, alpha: 1)
@objc open dynamic var selectedBackgroundColor = UIColor(white: 0.8, alpha: 1)
/// Helper object for configuring cell borders.
open lazy var border: BorderHelper = {
BorderHelper(view: self)
Expand Down Expand Up @@ -47,7 +47,7 @@ open class DataGridViewBaseCell: UICollectionViewCell {

open override func layoutSubviews() {
super.layoutSubviews()
textLabel.frame = UIEdgeInsetsInsetRect(bounds, textLabelInsets)
textLabel.frame = bounds.inset(by: textLabelInsets)
}

open override func layoutSublayers(of layer: CALayer) {
Expand All @@ -60,36 +60,36 @@ open class DataGridViewBaseCell: UICollectionViewCell {

// Border getters/setters for UIAppearance
extension DataGridViewBaseCell {
public dynamic var borderTopWidth: CGFloat {
@objc public dynamic var borderTopWidth: CGFloat {
get { return border.topWidth }
set { border.topWidth = newValue }
}
public dynamic var borderTopColor: UIColor {
@objc public dynamic var borderTopColor: UIColor {
get { return border.topColor }
set { border.topColor = newValue }
}
public dynamic var borderLeftWidth: CGFloat {
@objc public dynamic var borderLeftWidth: CGFloat {
get { return border.leftWidth }
set { border.leftWidth = newValue }
}
public dynamic var borderLeftColor: UIColor {
@objc public dynamic var borderLeftColor: UIColor {
get { return border.leftColor }
set { border.leftColor = newValue }
}
public dynamic var borderBottomWidth: CGFloat {
@objc public dynamic var borderBottomWidth: CGFloat {
get { return border.bottomWidth }
set { border.bottomWidth = newValue }
}
public dynamic var borderBottomColor: UIColor {
@objc public dynamic var borderBottomColor: UIColor {
get { return border.bottomColor }
set { border.bottomColor = newValue }
}
public dynamic var borderRightWidth: CGFloat {
@objc public dynamic var borderRightWidth: CGFloat {
get { return border.rightWidth }
set { border.rightWidth = newValue }
}

public dynamic var borderRightColor: UIColor {
@objc public dynamic var borderRightColor: UIColor {
get { return border.rightColor }
set { border.rightColor = newValue }
}
Expand Down
8 changes: 4 additions & 4 deletions Source/Cells/DataGridViewBaseHeaderCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ open class DataGridViewBaseHeaderCell: DataGridViewBaseCell {
}
}
/// Background color for sorted state
open dynamic var sortedBackgroundColor: UIColor? {
@objc open dynamic var sortedBackgroundColor: UIColor? {
didSet {
updateSortedTitleAndBackground()
}
Expand All @@ -37,9 +37,9 @@ open class DataGridViewBaseHeaderCell: DataGridViewBaseCell {
}
}
/// This suffix will be appended to title if column/row is sorted in ascending order.
open dynamic var sortAscSuffix: String?
@objc open dynamic var sortAscSuffix: String?
/// This suffix will be appended to title if column/row is sorted in descending order.
open dynamic var sortDescSuffix: String?
@objc open dynamic var sortDescSuffix: String?
/// Header title. Use this property instead of assigning to textLabel.text.
open var title: String = "" {
didSet {
Expand Down Expand Up @@ -95,7 +95,7 @@ open class DataGridViewBaseHeaderCell: DataGridViewBaseCell {
self.indexPath = indexPath
}

open func didTap(_ gesture: UITapGestureRecognizer) {
@objc open func didTap(_ gesture: UITapGestureRecognizer) {
dataGridView.collectionViewDelegate.collectionView(dataGridView.collectionView, didTapHeaderForColumn: indexPath.index)
}
}
10 changes: 5 additions & 5 deletions Source/Cells/DataGridViewColumnHeaderCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ open class DataGridViewColumnHeaderCell: DataGridViewBaseHeaderCell {

if let labelAppearance = UILabel.glyuck_appearanceWhenContained(in: DataGridViewColumnHeaderCell.self) {
if #available(iOS 8.2, *) {
labelAppearance.appearanceFont = UIFont.systemFont(ofSize: 14, weight: UIFontWeightRegular)
labelAppearance.appearanceFont = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.regular)
} else {
labelAppearance.appearanceFont = UIFont(name: "HelveticaNeue", size: 14)
}
Expand All @@ -32,10 +32,10 @@ open class DataGridViewColumnHeaderCell: DataGridViewBaseHeaderCell {

}()
// MARK: - UIView
open override static func initialize() {
super.initialize()
_ = DataGridViewColumnHeaderCell.__once
}
// open override static func initialize() {
// super.initialize()
// _ = DataGridViewColumnHeaderCell.__once
// }

// MARK: - Custom methods

Expand Down
10 changes: 5 additions & 5 deletions Source/Cells/DataGridViewContentCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ open class DataGridViewContentCell: DataGridViewBaseCell {

if let labelAppearance = UILabel.glyuck_appearanceWhenContained(in: DataGridViewContentCell.self) {
if #available(iOS 8.2, *) {
labelAppearance.appearanceFont = UIFont.systemFont(ofSize: 14, weight: UIFontWeightLight)
labelAppearance.appearanceFont = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.light)
} else {
labelAppearance.appearanceFont = UIFont(name: "HelveticaNeue-Light", size: 14)
}
Expand All @@ -26,8 +26,8 @@ open class DataGridViewContentCell: DataGridViewBaseCell {
}

}()
open override static func initialize() {
super.initialize()
_ = DataGridViewContentCell.__once
}
// open override static func initialize() {
// super.initialize()
// _ = DataGridViewContentCell.__once
// }
}
2 changes: 1 addition & 1 deletion Source/Cells/DataGridViewRowHeaderCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ open class DataGridViewRowHeaderCell: DataGridViewBaseHeaderCell {

if let labelAppearance = UILabel.glyuck_appearanceWhenContained(in: DataGridViewRowHeaderCell.self) {
if #available(iOS 8.2, *) {
labelAppearance.appearanceFont = UIFont.systemFont(ofSize: 14, weight: UIFontWeightRegular)
labelAppearance.appearanceFont = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.regular)
} else {
labelAppearance.appearanceFont = UIFont(name: "HelveticaNeue", size: 14)
}
Expand Down
14 changes: 7 additions & 7 deletions Source/DataGridView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ open class DataGridView: UIView {
/// Width for vertical header displayed on left of each row. If zero, vertical headers are not displayed.
open var rowHeaderWidth: CGFloat = 0
/// Background color for even rows of zebra-striped tables.
open dynamic var row1BackgroundColor: UIColor?
@objc open dynamic var row1BackgroundColor: UIColor?
/// Background color for odd rows of zebra-striped tables.
open dynamic var row2BackgroundColor: UIColor?
@objc open dynamic var row2BackgroundColor: UIColor?

/// Current sort column of data grid view.
fileprivate(set) open var sortColumn: Int?
Expand Down Expand Up @@ -334,7 +334,7 @@ open class DataGridView: UIView {
collectionView.indexPathsForSelectedItems?.forEach { collectionView.deselectItem(at: $0, animated: animated) }
for column in 0..<numberOfColumns() {
let indexPath = IndexPath(item: column, section: row)
collectionView.selectItem(at: indexPath, animated: animated, scrollPosition: UICollectionViewScrollPosition())
collectionView.selectItem(at: indexPath, animated: animated, scrollPosition: UICollectionView.ScrollPosition())
}
}

Expand Down Expand Up @@ -469,10 +469,10 @@ open class DataGridView: UIView {

// UIView

open override static func initialize() {
super.initialize()
_ = DataGridView.__once
}
// public override static func initialize() {
// super.initialize()
// _ = DataGridView.__once
// }

public override init(frame: CGRect) {
super.init(frame: frame)
Expand Down
30 changes: 0 additions & 30 deletions Source/Utility/IndexPath+DataGrid.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,3 @@ public extension IndexPath {
return self[0]
}
}


public extension NSIndexPath {
/**
Returns an index-path object initialized with the indexes of a specific row and column in a data grid view.

- parameter column: An index number identifying a column in a DataGridView object in a row identified by the row parameter.
- parameter row: An index number identifying a row in a DataGridView object.

- returns: An NSIndexPath object.
*/
convenience init(forColumn column: Int, row: Int) {
self.init(item: column, section: row)
}

/// An index number identifying a column in a row of a data grid view. (read-only)
var dataGridColumn: Int {
return self.index(atPosition: 1)
}

/// An index number identifying a row in a data grid view. (read-only)
var dataGridRow: Int {
return self.index(atPosition: 0)
}

/// An index number for single-item indexPath
var index: Int {
return self.index(atPosition: 0)
}
}