Permalink
Browse files

Docs added

  • Loading branch information...
1 parent b47fca1 commit afae628e30d3b37576d678eac16231dc99ef6086 @AlexDenisov committed Oct 29, 2012
View
@@ -0,0 +1,9 @@
+## Contribute to FontasticIcons
+
+If you want to contribute to FontasticIcons, follow this process:
+
+1. Fork the project
+2. Create a feature branch
+3. Code
+4. Create a pull request
+
@@ -26,6 +26,7 @@
CA7C5606163E3AAD00AC32A3 /* FIEntypoIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = CA7C5605163E3AAD00AC32A3 /* FIEntypoIcon.m */; };
CA7C5609163E433400AC32A3 /* CoreText.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CA7C5608163E433400AC32A3 /* CoreText.framework */; };
CA7C561A163EFBCC00AC32A3 /* FIEntypoSocialIcon.m in Sources */ = {isa = PBXBuildFile; fileRef = CA7C5619163EFBCC00AC32A3 /* FIEntypoSocialIcon.m */; };
+ CA7C561E163F060500AC32A3 /* FIMetaInfoManager.m in Sources */ = {isa = PBXBuildFile; fileRef = CA7C561D163F060500AC32A3 /* FIMetaInfoManager.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -61,6 +62,8 @@
CA7C5608163E433400AC32A3 /* CoreText.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreText.framework; path = System/Library/Frameworks/CoreText.framework; sourceTree = SDKROOT; };
CA7C5618163EFBCC00AC32A3 /* FIEntypoSocialIcon.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FIEntypoSocialIcon.h; sourceTree = "<group>"; };
CA7C5619163EFBCC00AC32A3 /* FIEntypoSocialIcon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FIEntypoSocialIcon.m; sourceTree = "<group>"; };
+ CA7C561C163F060500AC32A3 /* FIMetaInfoManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FIMetaInfoManager.h; sourceTree = "<group>"; };
+ CA7C561D163F060500AC32A3 /* FIMetaInfoManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FIMetaInfoManager.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -148,6 +151,7 @@
CA7C55E8163DC49C00AC32A3 /* Base */ = {
isa = PBXGroup;
children = (
+ CA7C561B163F049100AC32A3 /* FIMetaInfoManager */,
CA7C5616163EFB4A00AC32A3 /* FIFont */,
CA7C5615163EFB2F00AC32A3 /* FIIcon */,
CA7C5614163EFB2100AC32A3 /* FIIconView */,
@@ -238,6 +242,15 @@
name = Entypo;
sourceTree = "<group>";
};
+ CA7C561B163F049100AC32A3 /* FIMetaInfoManager */ = {
+ isa = PBXGroup;
+ children = (
+ CA7C561C163F060500AC32A3 /* FIMetaInfoManager.h */,
+ CA7C561D163F060500AC32A3 /* FIMetaInfoManager.m */,
+ );
+ name = FIMetaInfoManager;
+ sourceTree = "<group>";
+ };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -315,6 +328,7 @@
CA7C55F8163DC81800AC32A3 /* FIFont.m in Sources */,
CA7C5606163E3AAD00AC32A3 /* FIEntypoIcon.m in Sources */,
CA7C561A163EFBCC00AC32A3 /* FIEntypoSocialIcon.m in Sources */,
+ CA7C561E163F060500AC32A3 /* FIMetaInfoManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -11,74 +11,58 @@
@implementation FIEntypoSocialIcon
-#pragma mark - Static fields
-
-static id _iconsDictionary = nil;
-static id _font = nil;
-
-#pragma mark - Overriden methods
-
+ (FIFont *)iconFont {
- if (_font == nil) {
- _font = [FIFont entypoSocialFont];
- }
- return _font;
+ return [FIFont entypoSocialFont];
}
-#pragma mark - Icons Dictionary
-
+ (NSDictionary *)iconsDictionary {
- if (_iconsDictionary == nil) {
- _iconsDictionary = [[NSDictionary alloc] initWithDictionary:
- @{
- @"github":@"\U0000F300",
- @"c-github":@"\U0000F301",
- @"flickr":@"\U0000F303",
- @"c-flickr":@"\U0000F304",
- @"vimeo":@"\U0000F306",
- @"c-vimeo":@"\U0000F307",
- @"twitter":@"\U0000F309",
- @"c-twitter":@"\U0000F30A",
- @"facebook":@"\U0000F30C",
- @"c-facebook":@"\U0000F30D",
- @"s-facebook":@"\U0000F30E",
- @"google+":@"\U0000F30F",
- @"c-google+":@"\U0000F310",
- @"pinterest":@"\U0000F312",
- @"c-pinterest":@"\U0000F313",
- @"tumblr":@"\U0000F315",
- @"c-tumblr":@"\U0000F316",
- @"linkedin":@"\U0000F318",
- @"c-linkedin":@"\U0000F319",
- @"dribbble":@"\U0000F31B",
- @"c-dribbble":@"\U0000F31C",
- @"stumbleupon":@"\U0000F31E",
- @"c-stumbleupon":@"\U0000F31F",
- @"lastfm":@"\U0000F321",
- @"c-lastfm":@"\U0000F322",
- @"rdio":@"\U0000F324",
- @"c-rdio":@"\U0000F325",
- @"spotify":@"\U0000F327",
- @"c-spotify":@"\U0000F328",
- @"qq":@"\U0000F32A",
- @"instagram":@"\U0000F32D",
- @"dropbox":@"\U0000F330",
- @"evernote":@"\U0000F333",
- @"flattr":@"\U0000F336",
- @"skype":@"\U0000F339",
- @"c-skype":@"\U0000F33A",
- @"renren":@"\U0000F33C",
- @"sina-weibo":@"\U0000F33F",
- @"paypal":@"\U0000F342",
- @"picasa":@"\U0000F345",
- @"soundcloud":@"\U0000F348",
- @"mixi":@"\U0000F34B",
- @"behance":@"\U0000F34E",
- @"google-circles":@"\U0000F351",
- @"vk":@"\U0000F354"
- }];
- }
- return _iconsDictionary;
+ return @{
+ @"github":@"\U0000F300",
+ @"c-github":@"\U0000F301",
+ @"flickr":@"\U0000F303",
+ @"c-flickr":@"\U0000F304",
+ @"vimeo":@"\U0000F306",
+ @"c-vimeo":@"\U0000F307",
+ @"twitter":@"\U0000F309",
+ @"c-twitter":@"\U0000F30A",
+ @"facebook":@"\U0000F30C",
+ @"c-facebook":@"\U0000F30D",
+ @"s-facebook":@"\U0000F30E",
+ @"google+":@"\U0000F30F",
+ @"c-google+":@"\U0000F310",
+ @"pinterest":@"\U0000F312",
+ @"c-pinterest":@"\U0000F313",
+ @"tumblr":@"\U0000F315",
+ @"c-tumblr":@"\U0000F316",
+ @"linkedin":@"\U0000F318",
+ @"c-linkedin":@"\U0000F319",
+ @"dribbble":@"\U0000F31B",
+ @"c-dribbble":@"\U0000F31C",
+ @"stumbleupon":@"\U0000F31E",
+ @"c-stumbleupon":@"\U0000F31F",
+ @"lastfm":@"\U0000F321",
+ @"c-lastfm":@"\U0000F322",
+ @"rdio":@"\U0000F324",
+ @"c-rdio":@"\U0000F325",
+ @"spotify":@"\U0000F327",
+ @"c-spotify":@"\U0000F328",
+ @"qq":@"\U0000F32A",
+ @"instagram":@"\U0000F32D",
+ @"dropbox":@"\U0000F330",
+ @"evernote":@"\U0000F333",
+ @"flattr":@"\U0000F336",
+ @"skype":@"\U0000F339",
+ @"c-skype":@"\U0000F33A",
+ @"renren":@"\U0000F33C",
+ @"sina-weibo":@"\U0000F33F",
+ @"paypal":@"\U0000F342",
+ @"picasa":@"\U0000F345",
+ @"soundcloud":@"\U0000F348",
+ @"mixi":@"\U0000F34B",
+ @"behance":@"\U0000F34E",
+ @"google-circles":@"\U0000F351",
+ @"vk":@"\U0000F354"
+ };
}
#pragma mark - Icons
@@ -10,9 +10,18 @@
#import "FIUtils.h"
#import "FIFont.h"
#import "FIIcon_Private.h"
+#import "FIMetaInfoManager.h"
@implementation FIIcon
++ (void)initialize {
+ FIMetaInfoManager *manager = [FIMetaInfoManager sharedManager];
+ [manager registerFont:[self iconFont]
+ forClass:self];
+ [manager registerIconSet:[self iconsDictionary]
+ forClass:self];
+}
+
- (void)dealloc {
self.iconString = nil;
self.iconName = nil;
@@ -28,7 +37,7 @@ + (NSString *)iconKeyForName:(NSString *)aName {
}
+ (FIFont *)iconFont {
- return nil;
+ return [[FIMetaInfoManager sharedManager] fontForClass:self];
}
+ (FIIcon *)iconWithName:(NSString *)anIconName {
@@ -39,7 +48,7 @@ + (FIIcon *)iconWithName:(NSString *)anIconName {
}
+ (NSDictionary *)iconsDictionary {
- return nil;
+ return [[FIMetaInfoManager sharedManager] iconSetForClass:self];
}
@end
@@ -0,0 +1,21 @@
+//
+// FIMetaInfoManager.h
+// FontasticIcons
+//
+// Created by Alex Denisov on 29.10.12.
+// Copyright (c) 2012 Alex Denisov. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@class FIFont;
+
+@interface FIMetaInfoManager : NSObject
+
++ (FIMetaInfoManager *)sharedManager;
+- (void)registerFont:(FIFont *)aFont forClass:(Class)aClass;
+- (FIFont *)fontForClass:(Class)aClass;
+- (void)registerIconSet:(NSDictionary *)anIcons forClass:(Class)aClass;
+- (NSDictionary *)iconSetForClass:(Class)aClass;
+
+@end
@@ -0,0 +1,57 @@
+//
+// FIMetaInfoManager.m
+// FontasticIcons
+//
+// Created by Alex Denisov on 29.10.12.
+// Copyright (c) 2012 Alex Denisov. All rights reserved.
+//
+
+#import "FIMetaInfoManager.h"
+
+@implementation FIMetaInfoManager
+{
+ NSMutableDictionary *fonts;
+ NSMutableDictionary *iconSets;
+}
+
+static id _instance = nil;
+
++ (FIMetaInfoManager *)sharedManager {
+ if (_instance == nil) {
+ _instance = [self new];
+ }
+ return _instance;
+}
+
+- (id)init {
+ self = [super init];
+ if (self) {
+ self->fonts = [NSMutableDictionary new];
+ self->iconSets = [NSMutableDictionary new];
+ }
+ return self;
+}
+
+- (void)registerFont:(FIFont *)aFont forClass:(Class)aClass {
+ NSString *key = NSStringFromClass(aClass);
+ [self->fonts setValue:aFont
+ forKey:key];
+}
+
+- (FIFont *)fontForClass:(Class)aClass {
+ NSString *key = NSStringFromClass(aClass);
+ return [self->fonts valueForKey:key];
+}
+
+- (void)registerIconSet:(NSDictionary *)anIcons forClass:(Class)aClass {
+ NSString *key = NSStringFromClass(aClass);
+ [self->iconSets setValue:anIcons
+ forKey:key];
+}
+
+- (NSDictionary *)iconSetForClass:(Class)aClass {
+ NSString *key = NSStringFromClass(aClass);
+ return [self->iconSets valueForKey:key];
+}
+
+@end
View
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Alexey Denisov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
@@ -0,0 +1,33 @@
+## FontasticIcons
+
+FontasticIcons is an Objective-C wrapper for iconic fonts.
+
+## Installation
+
+### With CocoaPods
+
+ pod 'FontasticIcons'
+
+### Manual
+
+Just add sources from `FontasticIcons/Sources` directory to your project.
+
+## Usage
+
+ FIIconView *iconView = [[FIIconView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)];
+ iconView.backgroundColor = [UIColor clearColor];
+ iconView.icon = [FIEntypoIcon leafIcon];
+ iconView.padding = 2;
+ iconView.iconColor = [UIColor greenColor];
+ [self.view addSubview:iconView];
+
+## Available fonts
+
+Right now added only [Entypo](http://www.entypo.com/) font.
+
+## License
+
+Source code distributed under MIT license.
+
+**Note that all fonts have it's own license.**
+

0 comments on commit afae628

Please sign in to comment.