Skip to content

Commit

Permalink
Comment style changed
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdrone committed Aug 24, 2017
1 parent 885f970 commit 7dba50c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 42 deletions.
8 changes: 0 additions & 8 deletions src/Buffer.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// BufferDiff.h
// BufferDiff
//
// Created by Alex Usbergo on 24/05/16.
// Copyright © 2016 Alex Usbergo. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for BufferDiff.
Expand Down
6 changes: 3 additions & 3 deletions src/Buffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ public class Buffer<ElementType: Diffable>: 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)
Expand Down
52 changes: 23 additions & 29 deletions src/PrototypeCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@ 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)
}

open class PrototypeTableViewCell : UITableViewCell, PrototypeViewCell {

/** The wrapped view. */
/// The wrapped view.
open var view: UIView!

open var model: Any? {
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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).")
Expand Down
4 changes: 2 additions & 2 deletions src/TableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import UIKit

open class TableView<Type: Diffable>: UITableView {

/** The elements for the table view. */
/// The elements for the table view.
open var elements = [ListItem<Type>]() {
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<ListItem<Type>> = {
return TableViewDiffAdapter(initialElements: [ListItem<Type>](), view: self)
}()
Expand Down

0 comments on commit 7dba50c

Please sign in to comment.