Skip to content

Commit

Permalink
Merge pull request #7 from cellular/feature/FixForXcode13.3
Browse files Browse the repository at this point in the history
Feature/fix for xcode13.3
  • Loading branch information
dimitribrukakis authored Apr 6, 2022
2 parents f4e189c + 775c435 commit 94e8e81
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CellularModelDataSource.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |spec|
spec.name = 'CellularModelDataSource'
spec.swift_version = '5.1'
spec.module_name = 'ModelDataSource'
spec.version = '6.0.0'
spec.version = '6.1.0'
spec.summary = 'Easy TableView and CollectionView data handling.'

# This description is used to generate tags and improve search results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,31 @@ extension UICollectionView: ModelDataSourceView {

// MARK: - ModelDataSourceViewDisplayable

extension ModelDataSourceViewDisplayable where Self: UICollectionView {
/// We need to add a typealias for each class that implements ModelDataSourceViewDisplayable
/// to make Xcode13.3 / Swift 5.6 happy. Otherwise we would have to implement
/// public static var staticSize: Size for every class separatelly.
/// https://stackoverflow.com/questions/71563154/how-to-implement-static-variables-of-associated-types-in-protocol-extensions-in

extension UICollectionViewCell {
public typealias Size = CGSize
}

extension UICollectionReusableView {
public typealias Size = CGSize
}

extension ModelDataSourceViewDisplayable where Self: UICollectionViewCell {

/// Optional fixed size definition to override dynamic height calculations.
public static var staticSize: CGSize? {
public static var staticSize: Size? {
return nil
}
}

extension ModelDataSourceViewDisplayable where Self: UICollectionReusableView {

/// Optional fixed size definition to override dynamic height calculations.
public static var staticSize: CGSize? {
public static var staticSize: Size? {
return nil
}
}
17 changes: 15 additions & 2 deletions Sources/ModelDataSource/UIKit/TableView+ModelDataSourceView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,31 @@ extension UITableView: ModelDataSourceView {

// MARK: - ModelDataSourceViewDisplayable

/// We need to add a typealias for each class that implements ModelDataSourceViewDisplayable
/// to make Xcode13.3 / Swift 5.6 happy. Otherwise we would have to implement
/// public static var staticSize: Size for every class separatelly.
/// https://stackoverflow.com/questions/71563154/how-to-implement-static-variables-of-associated-types-in-protocol-extensions-in

extension UITableViewCell {
public typealias Size = CGFloat
}

extension UITableViewHeaderFooterView {
public typealias Size = CGFloat
}

extension ModelDataSourceViewDisplayable where Self: UITableViewCell {

/// Optional fixed size definition to override dynamic height calculations.
public static var staticSize: CGFloat? {
public static var staticSize: Size? {
return nil
}
}

extension ModelDataSourceViewDisplayable where Self: UITableViewHeaderFooterView {

/// Optional fixed size definition to override dynamic height calculations.
public static var staticSize: CGFloat? {
public static var staticSize: Size? {
return nil
}
}

0 comments on commit 94e8e81

Please sign in to comment.