diff --git a/src/Buffer.h b/src/Buffer.h index 075d24a..b240741 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -1,11 +1,3 @@ -// -// BufferDiff.h -// BufferDiff -// -// Created by Alex Usbergo on 24/05/16. -// Copyright © 2016 Alex Usbergo. All rights reserved. -// - #import //! Project version number for BufferDiff. diff --git a/src/Buffer.swift b/src/Buffer.swift index b0a5c40..17244ec 100644 --- a/src/Buffer.swift +++ b/src/Buffer.swift @@ -168,9 +168,9 @@ public class Buffer: NSObject, BufferType { /// This message is sent to the receiver when the value at the specified key path relative /// to the given object has changed. public override func observeValue(forKeyPath keyPath: String?, - of object: Any?, - change: [NSKeyValueChangeKey : Any]?, - context: UnsafeMutableRawPointer?) { + of object: Any?, + change: [NSKeyValueChangeKey : Any]?, + context: UnsafeMutableRawPointer?) { if context != &__observationContext { super.observeValue(forKeyPath: keyPath, of:object, change:change, context:context) diff --git a/src/PrototypeCell.swift b/src/PrototypeCell.swift index c0c1b44..b13a650 100644 --- a/src/PrototypeCell.swift +++ b/src/PrototypeCell.swift @@ -3,12 +3,11 @@ import UIKit public protocol PrototypeViewCell: ListViewCell { - /** The TableView or CollectionView that owns this cell. */ + /// The TableView or CollectionView that owns this cell. var referenceView: ListContainerView? { get set } - /** Apply the model. - * - Note: This is used internally from the infra to set the model. - */ + /// Apply the model. + /// - Note: This is used internally from the infra to set the model. func applyModel(_ model: Any?) init(reuseIdentifier: String) @@ -16,7 +15,7 @@ public protocol PrototypeViewCell: ListViewCell { open class PrototypeTableViewCell : UITableViewCell, PrototypeViewCell { - /** The wrapped view. */ + /// The wrapped view. open var view: UIView! open var model: Any? { @@ -56,20 +55,18 @@ open class PrototypeTableViewCell : UITableViewCell, PrototypeViewCell { self.model = model } - /** Asks the view to calculate and return the size that best fits the specified size. - * - parameter size: The size for which the view should calculate its best-fitting size. - * - returns: A new size that fits the receiver’s subviews. - */ + /// Asks the view to calculate and return the size that best fits the specified size. + /// - parameter size: The size for which the view should calculate its best-fitting size. + /// - returns: A new size that fits the receiver’s subviews. open override func sizeThatFits(_ size: CGSize) -> CGSize { let size = view.sizeThatFits(size) return size } - /** Returns the natural size for the receiving view, considering only properties of the - * view itself. - * - returns: A size indicating the natural size for the receiving view based on its - * intrinsic properties. - */ + /// Returns the natural size for the receiving view, considering only properties of the + /// view itself. + /// - returns: A size indicating the natural size for the receiving view based on its + /// intrinsic properties. open override var intrinsicContentSize : CGSize { return view.intrinsicContentSize } @@ -119,20 +116,18 @@ open class PrototypeCollectionViewCell: UICollectionViewCell, PrototypeViewCell self.model = model } - /** Asks the view to calculate and return the size that best fits the specified size. - * - parameter size: The size for which the view should calculate its best-fitting size. - * - returns: A new size that fits the receiver’s subviews. - */ + /// Asks the view to calculate and return the size that best fits the specified size. + /// - parameter size: The size for which the view should calculate its best-fitting size. + /// - returns: A new size that fits the receiver’s subviews. open override func sizeThatFits(_ size: CGSize) -> CGSize { let size = view.sizeThatFits(size) return size } - /** Returns the natural size for the receiving view, considering only properties of the - * view itself. - * - returns: A size indicating the natural size for the receiving view based on its - * intrinsic properties. - */ + /// Returns the natural size for the receiving view, considering only properties of the + /// view itself. + /// - returns: A size indicating the natural size for the receiving view based on its + /// intrinsic properties. open override var intrinsicContentSize : CGSize { return view.intrinsicContentSize } @@ -141,21 +136,20 @@ open class PrototypeCollectionViewCell: UICollectionViewCell, PrototypeViewCell public struct Prototypes { fileprivate static var registeredPrototypes = [String: PrototypeViewCell]() - /** Wether there's a prototype registered for a given reusedIdentifier. */ + /// Wether there's a prototype registered for a given reusedIdentifier. public static func isPrototypeCellRegistered(_ reuseIdentifier: String) -> Bool { guard let _ = Prototypes.registeredPrototypes[reuseIdentifier] else { return false } return true } - /** Register a cell a prototype for a given reuse identifer. */ + /// Register a cell a prototype for a given reuse identifer. public static func registerPrototypeCell(_ reuseIdentifier: String, cell: PrototypeViewCell){ Prototypes.registeredPrototypes[reuseIdentifier] = cell } - /** Computes the size for the cell registered as prototype associate to the item passed - * as argument. - * - parameter item: The target item for size calculation. - */ + /// Computes the size for the cell registered as prototype associate to the item passed + /// as argument. + /// - parameter item: The target item for size calculation. public static func prototypeCellSize(_ item: ListItemType) -> CGSize { guard let cell = Prototypes.registeredPrototypes[item.reuseIdentifier] else { fatalError("Unregistered prototype with reuse identifier \(item.reuseIdentifier).") diff --git a/src/TableView.swift b/src/TableView.swift index 3994952..0e6025c 100644 --- a/src/TableView.swift +++ b/src/TableView.swift @@ -3,14 +3,14 @@ import UIKit open class TableView: UITableView { - /** The elements for the table view. */ + /// The elements for the table view. open var elements = [ListItem]() { didSet { self.adapter.buffer.update(with: self.elements) } } - /** The adapter for this table view. */ + /// The adapter for this table view. open lazy var adapter: TableViewDiffAdapter> = { return TableViewDiffAdapter(initialElements: [ListItem](), view: self) }()