Giter Site home page Giter Site logo

home-assistant / iconic Goto Github PK

View Code? Open in Web Editor NEW
1.6K 20.0 86.0 27.16 MB

:art: Auto-generated icon font library for iOS, watchOS and tvOS

License: Apache License 2.0

Ruby 10.18% Swift 44.14% HTML 2.42% JavaScript 9.54% CSS 5.85% Shell 27.87%
code-generator icon-font swift ios tvos watchos interface-builder

iconic's Issues

How to use the latest version of SwiftGen

I found that the version of SwiftGen in the project is 0.8.0, which is already an old version of SwiftGen. I tried to modify the latest version of SwiftGen, but I found that the new version of SwiftGen no longer has' icons 'to execute commands

截屏2021-08-16 15 39 42

Getting errors from Swift files

  • About 118 Errors from many swift files
  • Error happens when this is checked in an Objective C Project.
  • Pods were successfully installed
  • No Error on 'module not found' occurred
  • Also tried converting the code versions of swift from 3 to 4 still no sign of build being generated

Rebuild using bitcode error

I get this error when trying to compile my app to my device.

"/Users/johnrehbein/Library/Developer/Xcode/DerivedData/FlipBook-dvfxorfebyxoypbxslfercvccsye/Build/Products/Debug-iphoneos/Iconic/Iconic.framework/Iconic' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64"

I'm not really sure how to rebuild this framework, so an update would be nice. For now I've just disabled bitcode in my app.

Add coverage with Snapshot Tests

Since this library is all about rendering, to make sure things don't break after v1, we should add as many useful snapshot tests as possible.
Things to cover:

  • Icon conversion to image
  • Icon conversion to image with padding (both, vertical and horizontal)
  • Icon conversion to attributed string
  • Composition of text + icon attributed string
  • UIKit extensions

Getting 'No Icon found'

I created a font using fontastic.me, installed with the .ttf file and all the SwiftGen generated Icon file has is import UIKit and a comment that says 'No Icon found'. I've tried it using FontAwesome's .ttf file and it works properly. Is there something I'm missing when creating the font or installing the pod?

Linker Error when building

Hey!

I am receiving a vague linker error when building. I followed the steps as mentioned in the README:

  1. add pod 'Iconic', :git => 'https://github.com/dzenbot/Iconic.git', :tag => '1.3' to podfile
  2. pod install (I only need font awesome for now)

Any suggestions for why this might be happening? I've done the whole clean, delete derived data etc etc. I also deleted and re-installed. I also installed the font on my computer (not sure if that is necessary).

Thanks!

Add WatchOS 2 support

Even though CoreText is available in WatchOS 2.2, I wasn't able to add support when trying. I should revisit this.

Unexpected behavior when installing custom fonts

per the documentation, I've included Iconic in my pod file pod 'Iconic', :git => 'https://github.com/dzenbot/Iconic.git', :tag => '1.3'
I perform the follow steps to update my pods.

FONT_PATH='/path/to/font/ionicons.ttf' pod install

FONT_PATH='/path/to/font/ionicons.ttf' pod update Iconic

the expected behavior is to see Ionicons.swift in my Pods/Pods/Iconic directory along with IconDrawable.swift and IconImageView.swift, but instead the generated file is FontAwesomeIcon.swift

Side Node

The following is presented as a result of running the command.

Pre-downloading: `Iconic` from `https://github.com/dzenbot/Iconic.git`, tag `1.3`
Downloading dependencies
...
Installing Iconic 1.2 (was 1.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 6 dependencies from the Podfile and 6 total pods installed.

I would think that having the 1.3 tag would result in installing Iconic 1.3

IconsFileParser failed to parse some ttf file

generated an icon file from icoMoon, the fontBook opened it fine but iconFileParser failed to parse it. Took a while to find the problem because it failed silently....

Looks like the culprit is in IconsFileParser.parseFile() where it tried to get CGFont from CTFont with CGFontCreateWithFontName(fontName), which returns nil so it returns without any warning...

FontAwesome icon name is different

I find the generated icon name is different with the website.

For example the check icon in this framework change to FontAwesomeIcon.okIcon is the bug of FontAwesome itself or something else?

Can not install

When I run:
FONT_PATH='path_to_your_icon_font.ttf' pod install Iconic

I get an error:
[!] Unknown command: Iconic

Could you tell me why?

how to update the ttf

now i try to update a new fonts file new.ttf, and when update finish always old.ttf..

plase help me!!

how to generate multiple fonts?

looks like we can only generate one font at a time because the source directory is override everytime. Wondering if the iconizer.sh can take a font directory (FONT_DIR) environment variable, in addition to the FONT_PATH, to generate for all the *.ttf files found in the directory?

Error registering / unregistering font file.

Hey. Cool project.

Everything was working great for about 2 weeks, then I started getting this error:

Error Domain=com.apple.CoreText.CTFontManagerErrorDomain Code=105 "Could not register the font file(s)"

So, I checked out error code 105 -> kCTFontManagerErrorAlreadyRegistered

I looked through Iconic's source and it doesn't look like the "already registered" case was handled, so I thought I'd just handle it myself in the app delegate by unregistering the font first:

let bundle = NSBundle(forClass: Iconic.self)
if let url = bundle.URLForResource("Linearicons", withExtension: "ttf"){
       var error: Unmanaged<CFErrorRef>? = nil
       CTFontManagerUnregisterFontsForURL(url, .None, &error)
       Iconic.registerIconFont()
}

However, the call to CTFontManagerUnregisterFontsForURL also returns an error:

Error Domain=com.apple.CoreText.CTFontManagerErrorDomain Code=201 "Could not unregister the font file(s)"

So, I checkout out error code 201 -> kCTFontManagerErrorNotRegistered

Not registered... o.O

Have you run into this before - not being able to register nor unregister a font? Tried cleaning, deleting my derived data, deleting the simulator's data, and double checked the font urls, but no luck.

Could Iconic try to continue its initialization in the case when the error is 105 - already registered?

Any suggestions appreciated.

Thanks!

Updating pod predownload to default for every pod update.

Hey,
I know this library is in beta but I still want to use it.
It seems that every time I need to update my pod file I have to point out the location for my font file, which then takes some time until it regenerate the Icon class, more than that if I'm doing plain
pod update it installs Iconic with the default Icon class and removes mine..

Is there a better workflow for this?

Image cache support

I was thinking of adding a cache layer to keep a reference of generated image instances. This could be helpful specially when the same icon with color and scale are requested multiple times.
Just putting this out there to see what users think. This is low priority for now.

At first, I was thinking of a NSCache wrapper but then discovered the power of LRU caches and seems more appropriate. I would hate having to add yet another dependency to this library, so maybe creating our own LRU cache implementation makes sense? Wouldn't know where to start tho, so any help is greatly appreciated!

stencil: Icon enum name not replaced

the stencil template hard coded the icon enum name as "Icon" instead of {{enumName}}. Therefore the generated swift file (Pods/Iconic/Source/FontAwesomeIcon.swift) has :
@objc public enum Icon: Int {...}

where it should be:
@objc public enum FontAwesomeIcon: Int {...}

Add support for brew

Hey dzenbot! I am currently working on second project where I want to use Iconic, but we have a small issue. As Pods (in our experience) increase build time, we decided to move to Carthage instead. Here comes the problem, Iconic is only available through Pods and it does not seems right to use Pods together with Carthage. We also use SwiftGen on this project and it has this nice command line interface so it can be used in build phase run script.

Is there any plan to implement CLI and then distribute Iconic with brew? Would be killer feature for us :-)

Add the ability to set a edge insets

When working with an attributed string, appending an icon with some other text may require some spacing between both elements. Using an optional edge insets could help avoiding to hardcode a whitespace with a string manually.

Rectangular Icons

Awesome Lib. Is support for rectangular non-square icons on the roadmap?

Provide a more Swifty template

Given that Iconic is based on SwiftGen, it's easy to provide more than one template for the user to choose from.

  • For people that still have to use ObjC, they can still use your current template.
  • But for people that would use Iconic in a Swift-only environment, it would be much better to have a more Swifty template that takes advantage of nested values, enum functions and Mixins.

Template suggestion

// Swift-only template

// Create IconicFont Mixin. Because Mixins are awesome.
public protocol IconicFont {
    public static func register()
    public static func font(fontSize: CGFloat) -> UIFont!
    public func attributedString(size: CGFloat, color: UIColor?) -> NSAttributedString!
    public func image(size: CGFloat, color: UIColor?) -> UIImage!
    public func unicodeString() -> String!
}

public extension IconicFont {
  … implementation goes here …
}

public enum FontAwesomeIcon: IconicFont {
  case Adjust
  case Adn
  case AlignCenter
  …
  // and it will get the IconicFont default implementations for free!
}

Usage

FontAwesomeIcon.register()
let font: UIFont = FontAwesomeIcon.font(size: 14)
let img: UIImage = FontAwesomeIcon.AlignCenter.image(size: 100, color: nil)

let icon = FontAwesomeIcon.AlignCenter
imageView.image = icon.image(size: imageView.bounds.size)
label.attributedText = icon.attributedString(size: 14)

UIImageView property

Hello guys,

If I want to use UIImageView properties with UIImage coming from iconic font, for example how can I set UIImageView mode to Aspect Fit and get the size of the font adjust with the size of the imageView ?

Thanks
best regards

Interface Builder support

The plan is to allow easy icon font integration with Interface Builder, by having a simple-to-use UIImageView subclass allowing to build icon font images internally.

Cannot install via CocoaPods

$ FONT_PATH='/Users/Plutonist/Downloads/130406-thin-line-ui/font/Flaticon.ttf' pod install
Analyzing dependencies
Downloading dependencies
Using Alamofire (3.4.2)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 14 dependencies from the Podfile and 14
total pods installed.
$ FONT_PATH='/Users/Plutonist/Downloads/130406-thin-line-ui/font/Flaticon.ttf' pod update Iconic
[!] The `Iconic` Pod is not installed and cannot be updated

The error output:
[!] The 'Iconic' Pod is not installed and cannot be updated


So I add pod 'Iconic', '~> 1.0.0-beta3' to Podfile.

But the install progress is stuck at Installing Iconic (1.0.0-beta3) line and no longer continue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.