ranesr / swifticons Goto Github PK
View Code? Open in Web Editor NEW🎢Swift Library for Font Icons - ★ this library
Home Page: https://ranesr.github.io/SwiftIcons/
License: MIT License
🎢Swift Library for Font Icons - ★ this library
Home Page: https://ranesr.github.io/SwiftIcons/
License: MIT License
In ionicons.com there are ion-ios-rewind
and ion-ios-rewind-outline
icons yet in SwifIcons they are spelled as iosReward
and iosRewardOutline
accordingly. They should be renamed.
Is there a way of making an icon have a corner radius when a background colour is present?
Hi, I'm using SwiftIcons library (installed though Pod).
I'm trying to create UIBarButtonItem with specific icon.
I set it like this:
menuButton.setIcon(icon: .ionicons(.navicon), iconSize: 35, color: systemColor)
where systemColor == UIView().tintColor
But with this setup, my UIBar looks like this:
As, you can see it is not aligned vertically (I tried using SetTitlePositionAdjustment
, but I can adjust only horizontal position).
I kinda fixed the position by using:
menuButton.setIcon(prefixText: "", icon: .ionicons(.navicon), iconColor: systemColor, postfixText: "", cgRect: CGRect(x: 30, y: 30, width: 30, height: 30), size: 35, iconSize: 36)
But, then button is not tappable...
Can anyone help me here?
On iOS9 and up, these terminal warnings are shown:
[Assert] button text attributes only respected for UIControlStateNormal, UIControlStateHighlighted, UIControlStateDisabled and UIControlStateFocused. state = 4 is interpreted as UIControlStateHighlighted.
Support for OSX object library
For example, when I click an airplane emoji ,then console prints UIImage.init(icon: .emoji(.airplane), size: CGSize(width: 35, height: 35))
I think showing the method is pretty helpful.Thank you!
I am assigning a button icon to different screen sizes. It only works on the iPhone settings and not the iPad.
storyboard constant settings.
iPad results - the icon does not resize. It also does not center to the new size. The text does center.
iphone settings are fine.
Using Swift 4.2 and Xcode 10.2.1
When I set a navigation bar like below, the icon gets cut off.
let settingsBarButton = UIBarButtonItem()
settingsBarButton.setIcon(icon: .emoji(.gear), iconSize: 30)
navigationItem.rightBarButtonItems = [settingsBarButton]
Not sure what's wrong since the example in your readme also uses size 30.
edit:
setting it via
settingsBarButton.image = UIImage(icon: .emoji(.gear), size: CGSize(width: 30, height: 30))
works fine
Need to add support for Swift Package Manager.
I have multiple UIBarButtonItems like this:
let plusButton = UIBarButtonItem(title: "Plus", style: .plain, target: self, action: #selector(showMore))
plusButton.setIcon(icon: .ionicons(.iosPlusOutline), iconSize: 25.0, color: Colors.drakGreen)
Till iOS 10 everthing worked fine. But under iOS 11 I get a questionmark placeholder when I press one of the buttons. This placeholder stays there until the action the button triggers is completed:
The last merged PR (#57) did not update the podspec file. Please, do so.
I have noticed the icons sometimes are rendered as question marks. This happens when you return to a view in the navigation stack or when a viewcontroller is presented in a modal.
Im using version 2.0.1 which should have a fix to a similar issue.
I have tested on an iPhone 8 plus with the latest iOS and on the Simulators and the issue is the same.
UIButton, UISegmentControl and UILabels all present the same issue.
Support for FontAwesome 5.
I added a label with icon and postfix text.
The icon is set to top position.
Please find my code
label.setIcon(prefixText: "", prefixTextColor: .clear, icon: .appsFont(.keyboard_arrow_down), iconColor:.blue, postfixText: text, postfixTextColor: .blue, size: 18, iconSize: 18)
I need that arrow center alignment to text.
Please suggest how to overcome this issue.
Thanks in advance.
i have a button but i want to change the post text only not the button how can i complete that
Hello,
Are all of these icons stored in the library? If so, how is the library so small?
Do only used icons from the library ship with the app bundle?
Thanks,
-Sami
Why does the function UILabel.setIcon(...)
change the alignment of the text on the label to .center
? The documentation on these functions do not specify that the alignment is changed. I found this to be unexpected behavior and I don't want to the alignment on my label to be changed when using this function.
Found in SwiftIcons.swift
in the following functions:
setIcon(prefixText: String, prefixTextColor: UIColor = .black, icon: FontType?, iconColor: UIColor = .black, postfixText: String, postfixTextColor: UIColor = .black, size: CGFloat?, iconSize: CGFloat? = nil) {
// ...
textAlignment = .center
}
setIcon(prefixText: String, prefixTextFont: UIFont, prefixTextColor: UIColor = .black, icon: FontType?, iconColor: UIColor = .black, postfixText: String, postfixTextFont: UIFont, postfixTextColor: UIColor = .black, iconSize: CGFloat? = nil) {
// ...
textAlignment = .center
}
Is there a reason why the alignment is changed? If not I would suggest removing the line.
Will there be an update released that fixes the errors in Swift 4.2?
I am using the following code alter the color of the text as well as the icon:
trendingTabButton.setIcon(icon: .emoji(.fire), iconColor: .red, title: "Title", titleColor: .yellow, backgroundColor: UIColor.clear, borderSize: 0, borderColor: UIColor.clear, forState: .normal)
But when I run this the title is red yet the icon is the default blue still
normally use enum to tell func what icon u want ?
cell.imgvIcon.setIcon(icon: .fontAwesome(.addressBook))
but if the icon type is from server, can i use string to set icon ?
cell.imgvIcon.setIcon(iconString: "fontAwesome.addressBook")
i found .text can get name of this icon.
Can i use this name as parameter?
It would be really nice to have interface builder support to see the preview of the icon selected. See Iconic library for example
While compiling my project copying icons take too much time especially Dripicons.ttf
which I don't use. I only use FontAwesomeSolid.ttf
. Is it possible to move icons to different pods so we can opt out like:
pod 'SwiftIcons', '~> 2.3.2'
pod 'SwiftIcons/FontAwesomeSolid'
Support carthage
many of the methods has been renamed
It might sound counterintuitive, but I wanted to use setIcon() to set a normal button title, with no icon at all.
Why I was trying to do this? I have a button, which changes its state - one of the states has icon and another doesn't have it. I simply wanted to have cleaner code like this:
enum ButtonState {
case gift, cancel
}
private func updateButton(state: ButtonState) {
self.buyGiftButton.setIcon(prefixText: "", prefixTextFont: myFont,
icon: state == .gift ? .fontAwesome(.gift) : nil,
postfixText: state == .gift ? " Buy as a gift" : "Cancel", postfixTextFont: myFont, postfixTextColor: .white,
backgroundColor: myColor, forState: .normal, iconSize: 20)
}
But it looks like the icon is force-unwrapped in there and this is not possible. Instead I had to make if-else and do .setAttributedTitle for that button.
It would be good if icon was really handled as an optional in setIcon (feature request).
Popular UIColor library Hue uses the UIColor(hex:) constructor in an extension, leading to a conflict with the convenience init in the UIColor extension.
public extension UIColor { convenience init(hex: String) {
Raising the error:
Ambiguous use of init(hex:)
Please remove or consider making Hue a dependency or using a non-conflicting category convenience method?
I have a UILabel which sometimes has an icon and sometimes not. By default the label is set with a bold font in the Storyboard and at the launch it does not contains any icon (the text is simply set with label.text
).
If I apply the icon and the text with .setIcon()
, the first time the bold attribute will stay but if I run .setIcon()
a second time to update the text content, the font will be overwritten with the standard one, being not bold.
The only workaround I found is to store in a variable during viewDidLoad()
the original bold font and before each execution of .setIcon()
I re-set the original font with label.font = initialLabelFont
.
Try to install via cocoapods but I have faced compatible issues. I have using Xcode 10.
[!] CocoaPods could not find compatible versions for pod "SwiftIcons":
In Podfile:
SwiftIcons (~> 2.2.0)
None of your spec sources contain a spec satisfying the dependency: SwiftIcons (~> 2.2.0)
.
You have either:
pod repo update
or with pod install --repo-update
.I've update the Xcode into 10.2.1 after I've cleaned the project and build again. Xcode struck on building SwiftIcons like there's no ending to it. There is no error appears so far.
Xcode Version 10.2.1 (10E1001)
SwiftIcons version 2.3.2
Swift Language Version 4.2
Can we get swift 4 supp? Now there are a lot of compile errors
I tend to have some vector icons I load up in custom font file. I wish there was support or I end up forking it and manually having to add it in. It would be nice if it was more dynamic as to be able to load font files of your choosing without including all of them.
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.