Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion Example-ionicons/Example-ionicons.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
objects = {

/* Begin PBXBuildFile section */
307938F01C1728E50034CC99 /* IonButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 307938EF1C1728E50034CC99 /* IonButton.swift */; };
30ACE8091C1780D8009EA9E6 /* IonImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30ACE8081C1780D8009EA9E6 /* IonImageView.swift */; };
554206721821715F005A3D9E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 554206711821715F005A3D9E /* Foundation.framework */; };
5542067418217160005A3D9E /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 554206731821715F005A3D9E /* CoreGraphics.framework */; };
5542067618217160005A3D9E /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5542067518217160005A3D9E /* UIKit.framework */; };
Expand All @@ -25,7 +27,7 @@
554206B018217179005A3D9E /* IonIcons.m in Sources */ = {isa = PBXBuildFile; fileRef = 554206AC18217179005A3D9E /* IonIcons.m */; };
554206B218217179005A3D9E /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 554206AE18217179005A3D9E /* LICENSE */; };
55E4275C1AE2DB6A00EF1098 /* FontInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = 55E4275B1AE2DB6A00EF1098 /* FontInspector.m */; };
55FFA09A1BDBFDD90004F457 /* ionicons.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 55FFA0991BDBFDD90004F457 /* ionicons.bundle */; settings = {ASSET_TAGS = (); }; };
55FFA09A1BDBFDD90004F457 /* ionicons.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 55FFA0991BDBFDD90004F457 /* ionicons.bundle */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand All @@ -39,6 +41,9 @@
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
307938EE1C1728E50034CC99 /* Example-ionicons-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Example-ionicons-Bridging-Header.h"; sourceTree = "<group>"; };
307938EF1C1728E50034CC99 /* IonButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IonButton.swift; sourceTree = "<group>"; };
30ACE8081C1780D8009EA9E6 /* IonImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IonImageView.swift; sourceTree = "<group>"; };
5542066E1821715F005A3D9E /* Example-ionicons.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Example-ionicons.app"; sourceTree = BUILT_PRODUCTS_DIR; };
554206711821715F005A3D9E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
554206731821715F005A3D9E /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -129,6 +134,7 @@
isa = PBXGroup;
children = (
644532D81BAB270E00DC25F0 /* README.md */,
307938EE1C1728E50034CC99 /* Example-ionicons-Bridging-Header.h */,
554206A918217179005A3D9E /* ionicons */,
5542068018217160005A3D9E /* AppDelegate.h */,
5542068118217160005A3D9E /* AppDelegate.m */,
Expand Down Expand Up @@ -182,6 +188,8 @@
554206AE18217179005A3D9E /* LICENSE */,
55E4275A1AE2DB6A00EF1098 /* FontInspector.h */,
55E4275B1AE2DB6A00EF1098 /* FontInspector.m */,
307938EF1C1728E50034CC99 /* IonButton.swift */,
30ACE8081C1780D8009EA9E6 /* IonImageView.swift */,
55FFA0991BDBFDD90004F457 /* ionicons.bundle */,
);
name = ionicons;
Expand Down Expand Up @@ -233,6 +241,7 @@
554206661821715F005A3D9E /* Project object */ = {
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0710;
LastUpgradeCheck = 0500;
ORGANIZATIONNAME = TapTemplate;
TargetAttributes = {
Expand Down Expand Up @@ -305,11 +314,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
307938F01C1728E50034CC99 /* IonButton.swift in Sources */,
5542068B18217160005A3D9E /* ViewController.m in Sources */,
5542068218217160005A3D9E /* AppDelegate.m in Sources */,
55E4275C1AE2DB6A00EF1098 /* FontInspector.m in Sources */,
5542067E18217160005A3D9E /* main.m in Sources */,
554206B018217179005A3D9E /* IonIcons.m in Sources */,
30ACE8091C1780D8009EA9E6 /* IonImageView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -446,10 +457,15 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Example-ionicons/Example-ionicons-Prefix.pch";
INFOPLIST_FILE = "Example-ionicons/Example-ionicons-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "../Example-ionicons/Example-ionicons/Example-ionicons-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand All @@ -459,10 +475,14 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
CLANG_ENABLE_MODULES = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Example-ionicons/Example-ionicons-Prefix.pch";
INFOPLIST_FILE = "Example-ionicons/Example-ionicons-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "../Example-ionicons/Example-ionicons/Example-ionicons-Bridging-Header.h";
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
Binary file modified Example-ionicons/Example-ionicons/.DS_Store
Binary file not shown.
16 changes: 11 additions & 5 deletions Example-ionicons/Example-ionicons/Base.lproj/Main_iPad.storyboard
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15A284" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none" useAutolayout="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
</dependencies>
<scenes>
<!--class Prefix:identifier View Controller-->
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="gHv-yz-yF4"/>
<viewControllerLayoutGuide type="bottom" id="HlK-vi-a5z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="20" width="768" height="1004"/>
<rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
Expand All @@ -23,4 +29,4 @@
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination"/>
</simulatedMetricsContainer>
</document>
</document>
Original file line number Diff line number Diff line change
@@ -1,26 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="4451" systemVersion="13A461" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9059" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3676"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
</dependencies>
<scenes>
<!--class Prefix:identifier View Controller-->
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="jPm-z5-1mB"/>
<viewControllerLayoutGuide type="bottom" id="QhC-0j-4v2"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="3BN-II-uDh" customClass="IonButton" customModule="Example_ionicons" customModuleProvider="target">
<rect key="frame" x="39" y="46" width="126" height="126"/>
<animations/>
<state key="normal" title="Button"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="ionIconBackgroundImage" value="f360"/>
</userDefinedRuntimeAttributes>
</button>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ec5-SY-64i" customClass="IonImageView" customModule="Example_ionicons" customModuleProvider="target">
<rect key="frame" x="27" y="231" width="241" height="150"/>
<animations/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="string" keyPath="ionIconImage" value="f360"/>
</userDefinedRuntimeAttributes>
</imageView>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="323" y="315"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
</document>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

#import "ionicons.h"
#import "ionicons-codes.h"
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,31 @@
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "29x29",
Expand Down
2 changes: 1 addition & 1 deletion ionicons.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Pod::Spec.new do |s|
s.author = { "David Sweetman" => "david@davidsweetman.com" }
s.source = { :git => "https://github.com/sweetmandm/ionicons-iOS.git", :tag => "2.0.3" }
s.platform = :ios, '5.0'
s.source_files = 'ionicons/**/*.{h,m}'
s.source_files = 'ionicons/**/*.{h,m,swift}'
s.resources = "ionicons/ionicons.bundle"
s.requires_arc = true
end
61 changes: 61 additions & 0 deletions ionicons/IonButton.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// IonButton.swift
// Example-ionicons
//
// Created by Max Campolo on 12/8/15.
// Copyright © 2015 Max Campolo. All rights reserved.
//

import UIKit

@IBDesignable
class IonButton: UIButton {

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Drawing code
}
*/

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
// Other stuff
}

override init(frame: CGRect) {
super.init(frame: frame)
}

@IBInspectable var ionIconBackgroundImage: String? {
get {
return self.currentBackgroundImage?.description
}
set {
self.setBackgroundImage(IonIcons.imageWithIcon(self.convertToUnicode(newValue!), size: self.frame.size.width, color: .blackColor()).imageWithRenderingMode(.AlwaysTemplate), forState:UIControlState.Normal)
}
}

@IBInspectable var ionIconImage: String? {
get {
return self.currentImage?.description
}
set {
self.setImage(IonIcons.imageWithIcon(self.convertToUnicode(newValue!), size: self.frame.size.width, color: .blackColor()).imageWithRenderingMode(.AlwaysTemplate), forState: .Normal)
}
}

func convertToUnicode(hexString: String) -> String? {
var result: String?
let scanner = NSScanner(string: hexString)
var unicodeInt = UInt32()
if scanner.scanHexInt(&unicodeInt) {
if let unicodeString: NSString = NSString(bytes: &unicodeInt, length: 4, encoding: NSUTF32LittleEndianStringEncoding) {
result = unicodeString as String
}
}
return result
}

}
51 changes: 51 additions & 0 deletions ionicons/IonImageView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// IonImageView.swift
// Example-ionicons
//
// Created by Max Campolo on 12/8/15.
// Copyright © 2015 Max Campolo. All rights reserved.
//

import UIKit

@IBDesignable
class IonImageView: UIImageView {

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
// Drawing code
}
*/

required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
// Other stuff
}

override init(frame: CGRect) {
super.init(frame: frame)
}

@IBInspectable var ionIconImage: String? {
get {
return self.image?.description
}
set {
self.image = IonIcons.imageWithIcon(self.convertToUnicode(newValue!), size: self.frame.size.width, color: .blackColor()).imageWithRenderingMode(.AlwaysTemplate)
}
}

func convertToUnicode(hexString: String) -> String? {
var result: String?
let scanner = NSScanner(string: hexString)
var unicodeInt = UInt32()
if scanner.scanHexInt(&unicodeInt) {
if let unicodeString: NSString = NSString(bytes: &unicodeInt, length: 4, encoding: NSUTF32LittleEndianStringEncoding) {
result = unicodeString as String
}
}
return result
}
}