👋
segecey / swifticonfont Goto Github PK
View Code? Open in Web Editor NEWIcons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon)
License: MIT License
Icons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon)
License: MIT License
👋
There are plenty of errors in Xcode 9
I am currently using the Pod of SwiftIconFont. First of all, thank you for your work on that.
However, it crashes when I try to use Ionicon. Here is the extract of relevant code:
self.standsIconLabel.font = UIFont.iconFontOfSize(.Ionicon, fontSize: 25.0)
It points to a error at
// FontLoader.swift, line 22
let data = NSData(contentsOfURL: fontURL)!
fatal error: unexpectedly found nil while unwrapping an Optional value
On the other hand, using:
self.standsIconLabel.font = UIFont.iconFontOfSize(.Ionicon, fontSize: 25.0)
works perfectly.
Please put changelog.md, so others can easily track which version of library supports which version of swift.
let text = x + " <light>fa:chevronright</light>"
let lightStyle = StringStyle(.color(.red))
let style = StringStyle(
.font(UIFont.systemFont(ofSize: 18)),
.lineHeightMultiple(1.8),
.color(.darkGray),
.xmlRules([
.style("light", lightStyle),
])
)
let attrText = text.styled(with: style)
view.textAlignment = .left
view.contentInsets = UIEdgeInsets(top: 0, left: 8, bottom: 0, right: 8)
view.attributedText = attrText
view.parseIcon()
The view
is a label.
I use BonMot
to style text.
But the parsed text is with no style.
The icon is shown correctly.
I'm using this method to setup a button in a custom uitableviewcell:
func buildIconText(button: UIButton, fontSize: CGFloat, fontName: String, text: String?, color: UIColor){
button.setTitleColor(color, for: .normal)
button.titleLabel?.font = UIFont.icon(from: .fontAwesome, ofSize: fontSize)
button.titleLabel?.text = String.fontAwesomeIcon(fontName)
if text != nil {
button.titleLabel?.text?.append(" ")
button.titleLabel?.text?.append(text!)
}
button.parseIcon()
}
This cause a flash blink on color when change the icon + text. The color pass by blank, blue tint, and finally the color received by params.
Someone knows how i can change the title of button, without blink color text ?
Hi dear:
Thanks at first! I cannot change image color when i use UITabBarItem! Can you help me? Thanks!
textField.placeholder = "ic:chevron-bottom"
textField.parseIcon()
not working
Hi,
I love your library and I've been using it for almost all of my apps, but I've come across this error when using more than one Material Icons in one app.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'The operation couldn’t be completed. (com.apple.CoreText.CTFontManagerErrorDomain error 105 - Could not register the CGFont '<CGFont (0x7f8a9345fd60): MaterialIcons-Regular>')'
Doing some research, it was complaining because it was trying to register the font again for some reason by calling FontLoader.loadFont(fontName)
twice for the same font. Basically, UIFont.fontNamesForFamilyName(fontName)
is still empty after the first registration.
I wasn't sure why it was not working for Material Icons, but my workaround was to call CTFontManagerUnregisterGraphicsFont
prior to calling CTFontManagerRegisterGraphicsFont
, which is an ugly fix, but I didn't look into the problem deeper and needed to find quick fix.
Anyways, I'm not sure if this is only happening to me but wanted to raise the issue for anyone else facing similar problem.
Thank you
Is there a way I could call a function once icon has rendered?
Right now I'm setting it like this:
func setIconWithSize(icon: String, font: Fonts, size: CGFloat) {
self.setTitle(String.fontIonIcon(icon), for: .normal)
self.titleLabel?.font = UIFont.icon(from: font, ofSize: size)
}
The problem is, initially I have my button hidden, and I unhide it right after I call this function:
shuffleButton.setIconWithSize(icon: shuffleIcon, font: .Ionicon, size: 24)
shuffleButton.isHidden = false
But it unhides button right at a millisecond before icon gets rendered.
So, I see old icon changing to a new one.
It be cool, to have some callback completion method
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
Doesn't work on Xcode 9.4.1
Installed SwiftIconFont via cocoapod but it still uses 2.7.1 even though 2.7.2 was released.
When i use material icon with one word for ex:"accessibility", i don't have any problem, but when i try to use icons with two or more words for ex: "flight_land" the icon doesen't appear. Here is an image http://imgur.com/OJ3mO66 and my code in addition
cellIcon.font = UIFont.icon(from: .MaterialIcon, ofSize: 30.0)
cellIcon.text = String.fontMaterialIcon(icon.replacingOccurrences(of: "ic_", with: "").replacingOccurrences(of: "_", with: "-"))
I did a pod update
recently and found build error in project due to SwiftIconFont.
After some debugging, I found SwiftIconFont updated from 2.7.1
to 2.7.2
The version 2.7.2
have migrated to support Swift 4.0. But I still use Swift 3.2 to compile and got the errors.
It seems not a minor change. So I suggest to use a major version number to tag it.
It will be good to have a note on README too.
Thanks for your effort to maintain this lib.
Whatsapp did not appear. I've been looking for a while. Fixed it by manually updating the FontAwesome.ttf file.
Seems a bit restrictive, no?
Hey buddy, would you be able to add Font Awesome 5 Icons? :)
how can i programmatically in swift change the icon on an existing button which already has the class.
Can we expect support for ionicons 3?
The lazy loading way of loading icons is great. However in storyboard, the icon name shows rather than the icon itself. Ex. the icon for "More" displays as "io:more" in storyboard rather than the actual "More Icon"
Any way this could be resolved?
There is a question at SwiftIconFont.swift
, I found that _NSRange
is used in func parseIcon()
, because it is a type alias of NSRange
, there should be no difference, I want to confirm your intention of using _NSRange
, thanks.
The pod only includes the FontAwesome.ttf file.
Is it possible to add icon and text together
import SwiftIconFont
let githubLogo = UIImage(from: .Octicon, code: "logo-github", textColor: .black, backgroundColor: .clear, size: CGSize(width: 150, height: 50))
Error: "Type of expression is ambiguous without more context"
I am using Swift 3.2, Xcode 9.1
Thanks
test:
let button = UIButton(frame: CGRect(x: 120, y: self.view.frame.size.height - 200, width: 150, height: 30))
button.setTitle("fa:chevron-left", for: .normal)
button.setTitleColor(.black, for: .normal)
button.parseIcon()
self.view.addSubview(button)
But the button says: fa:chevron_left
When it comes to:
button.setTitle("oc:logo-github", for: .normal)
It's OK.
Can you upload the Swift 4.2 support to CocoaPods?
Hi,
Will you implement FontAwesome Payment icons?
Thanks
The extensions directory isn't being copied down via the default pod instal or update command. As a result, none of the extensions for classes like UIImageView are available.
I had to clone your repository, and change my Podfile like this:
pod 'SwiftIconFont', :path => '~/Developer/SwiftIconFont'
Where ~/Developer is where I have an unmodified close of your repository.
I'm not an expert by any means in Cocoapod pod spec files, but my gut is the Extensions directory needs to be added to it. The way I read it, only the Classes and .ttf resources are getting included.
Cocoa pods seems to be missing necessary files
no references to SwiftBarButtonItem, etc. Your pod spec here is versioned @ 2.5, but cocoa pods only has 2.4 registered. So not sure if there was an error uploading podpsec
Great project.
Warning text:
/Path/To/SwiftIconFont.swift:305:56:
Conditional downcast from 'String?' to 'NSString' is a bridging conversion; did you mean to use 'as'?
Xcode 8.3.1 (8E1000a)
Change from
guard let currentTitle = self.titleLabel?.text as? NSString else { return }
Change to
guard let currentTitle = self.titleLabel?.text as NSString? else { return }
when UIBarButtonItem is disabled, the icon is shown as a question mark.
When will you release swift 3 compatible version? Thanks
Hi,
Love this framework but I seem to have a problem with parseIcon, as it works only with fa:*
I tried all other sources but non of them works.
I am working with Xcode 8 running iOS target 9.0, the device it self has iOS 10
Thanks.
The code below works for a normal UIViewController
let settingBarButtonItem = UIBarButtonItem(title: "settings", style: .plain, target: self, action: #selector(showSetting))
settingBarButtonItem.icon(from: .materialIcon, code: "settings", ofSize: 20)
navigationItem.rightBarButtonItem = settingBarButtonItem
But for UIDocumentBrowserViewController, additionalTrailingNavigationBarButtonItems is used to add extra items.
additionalTrailingNavigationBarButtonItems = [settingBarButtonItem]
When I did it, the icon always shows as a question mark.
@0x73
Whenever I add a stroke to my Icon, the stroke outline is there but the Icon color either disappears or is completely transparent
It's working well on simulator but not working on devices.?
*** Skipped building SwiftIconFont due to the error:
Dependency "SwiftIconFont" has no shared framework schemes for any of the platforms: iOS
If you believe this to be an error, please file an issue with the maintainers at https://github.com/goabra/SwiftIconFont/issues/new
It seems that second half of Ionicons are not available.
Also android-chat displays thumbdown icon.
although I'm able to get the image on the tabbar i have issues when selected to change the image.
I was testing this out and it looks like the UIBarButtonItem and UITabBarItem extensions aren't public.
I edited this and changed them to public and then the methods work fine. I figured this was a simple enough fix it wasn't worth creating a PR.
Please update to the latest Swift 3 syntax. Thank you.
Possibility to use a Custom Icon Font.
'weak' may only be applied to class and class-bound protocol types, not '<>'
help me please .
Hey 🙌
First of all: Great work with SwiftIconFont!
I'm enjoying and using it as a sub-dependency in the STLocationRequest library.
Are there any plans to add an tvOS
target and scheme to SwiftIconFont to allow using it via Carthage when building for thetvOS
platform?
$ carthage update --platform tvOS
*** Skipped building SwiftIconFont due to the error:
Dependency "SwiftIconFont" has no shared framework schemes for any of the platforms: tvOS
Thank you for a great framework. I love it.
The function GetIconIndexWithSelectedIcon()
does a curious conversion between NSString
and String
. I don't think this is necessary.
Perhaps change from:
for substring in ((text as String).split{$0 == " "}.map(String.init)) {
Change to:
for substring in icon.components(separatedBy: " ") {
The SwiftIconFont.swift
file uses NSString
several places, where it could be a String
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.