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
4 changes: 2 additions & 2 deletions Source/Cells/DataGridViewBaseCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import UIKit
/**
Base class for data grid view cells.
*/
open class DataGridViewBaseCell: UICollectionViewCell {
@objcMembers open class DataGridViewBaseCell: UICollectionViewCell {
/// The inset or outset margins for the rectangle around the cell’s text label.
open dynamic var textLabelInsets = UIEdgeInsets.zero
/// Background color for highlighted state.
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 Down
13 changes: 9 additions & 4 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 @@ -31,9 +31,14 @@ open class DataGridViewColumnHeaderCell: DataGridViewBaseHeaderCell {
}

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

public override init(frame: CGRect) {
super.init(frame: frame)
_ = DataGridViewColumnHeaderCell.__once
}

public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
_ = DataGridViewColumnHeaderCell.__once
}

Expand Down
12 changes: 9 additions & 3 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,14 @@ open class DataGridViewContentCell: DataGridViewBaseCell {
}

}()
open override static func initialize() {
super.initialize()

public override init(frame: CGRect) {
super.init(frame: frame)
_ = DataGridViewContentCell.__once
}

public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
_ = DataGridViewContentCell.__once
}
}
12 changes: 9 additions & 3 deletions 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 All @@ -32,8 +32,14 @@ open class DataGridViewRowHeaderCell: DataGridViewBaseHeaderCell {
}

}()
open override static func initialize() {
super.initialize()

public override init(frame: CGRect) {
super.init(frame: frame)
_ = DataGridViewRowHeaderCell.__once
}

public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
_ = DataGridViewRowHeaderCell.__once
}
}
14 changes: 6 additions & 8 deletions Source/DataGridView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ import UIKit
/**
An instance of DataGridView (or simply, a data grid view) is a means for displaying and editing data represented in multicolumn tables (or 2-dimension matrices).
*/
open class DataGridView: UIView {
@objcMembers open class DataGridView: UIView {
private static var __once: () = {
let appearance = DataGridView.appearance()
appearance.row1BackgroundColor = UIColor(white: 0.95, alpha: 1)
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 @@ -468,19 +468,15 @@ open class DataGridView: UIView {
}

// UIView

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

public override init(frame: CGRect) {
super.init(frame: frame)
_ = DataGridView.__once
setupDataGridView()
}

public required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
_ = DataGridView.__once
setupDataGridView()
}

Expand All @@ -494,4 +490,6 @@ open class DataGridView: UIView {
open func setContentOffset(_ contentOffset: CGPoint, animated: Bool) {
collectionView.setContentOffset(contentOffset, animated: animated)
}


}
2 changes: 1 addition & 1 deletion Source/Utility/IndexPath+DataGrid.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public extension IndexPath {
}


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

Expand Down