Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
Merge pull request #86 from bnsm/missing-count-variable
Browse files Browse the repository at this point in the history
Missing count variable
  • Loading branch information
robbiet480 authored Aug 6, 2019
2 parents ed5c982 + 189e3ab commit d908d2d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Samples/Tests/IconDrawableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ class IconDrawableTests: XCTestCase {
let range = NSRange(location: 0, length: string.length)

XCTAssertNotNil(string)

string.enumerateAttribute(NSFontAttributeName, in: range, options: NSAttributedString.EnumerationOptions(rawValue: 0)) { (value, range, stop) -> Void in
string.enumerateAttribute(NSAttributedString.Key.font, in: range, options: NSAttributedString.EnumerationOptions(rawValue: 0)) { (value, range, stop) -> Void in
if let font = value as? UIFont {
XCTAssertEqual(font.familyName, TestIcon.familyName)
}
Expand Down
4 changes: 2 additions & 2 deletions Samples/Tests/StringIconSnapshotTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class StringIconSnapshotTests: BaseSnapshotTestCase {
let attributedText = NSMutableAttributedString()
let iconString = icon.attributedString(ofSize: 25, color: nil, edgeInsets: edgeInset)

let titleAttributes = [NSFontAttributeName: UIFont.systemFont(ofSize: 25),
NSForegroundColorAttributeName: UIColor.black] as [String : AnyObject]
let titleAttributes = [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 25),
NSAttributedString.Key.foregroundColor: UIColor.black]

let titleAttrString = NSAttributedString(string: icon.name, attributes: titleAttributes)

Expand Down
2 changes: 1 addition & 1 deletion Samples/Tests/UIExtensionSnapshotTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class UIExtensionSnapshotTests: BaseSnapshotTestCase {
func testUIButton() {

let button = UIButton(type: .system)
button.setIconImage(withIcon: .downloadIcon, size: defaultSize, color: nil, forState: UIControlState())
button.setIconImage(withIcon: .downloadIcon, size: defaultSize, color: nil, forState: UIControl.State())
button.sizeToFit()

self.verifyView(button, withIdentifier: "")
Expand Down
10 changes: 10 additions & 0 deletions Source/iconic-default.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import UIKit
return {{enumName}}.familyName as NSString
}

/** The icon font's total count of available icons. */
class var {{enumName|lowerFirstWord}}Count: NSInteger {
return {{enumName}}.count
}

/**
Returns the icon font object for the specified size.

Expand Down Expand Up @@ -173,6 +178,11 @@ extension {{enumName}} : IconDrawable {
return "{{familyName}}"
}

/** The icon font's total count of available icons. */
public static var count: Int {
return {{ icons.count }}
}

/**
Creates a new instance with the specified icon name.
If there is no valid name recognised, this initializer falls back to the first available icon.
Expand Down

0 comments on commit d908d2d

Please sign in to comment.