Skip to content

Commit

Permalink
0.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
EyreFree committed Sep 5, 2019
1 parent ef730c2 commit abb28be
Show file tree
Hide file tree
Showing 14 changed files with 470 additions and 144 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,13 @@

-----

## [0.6.3](https://github.com/EFPrefix/EFIconFont/releases/tag/0.6.3) (2019-09-05)

- Reduce hawconstroke.ttf file size;
- Update demo project.

---

## [0.6.2](https://github.com/EFPrefix/EFIconFont/releases/tag/0.6.2) (2019-09-03)

- Add WeatherIcons;
Expand Down
2 changes: 1 addition & 1 deletion EFIconFont.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'EFIconFont'
s.version = '0.6.2'
s.version = '0.6.3'
s.summary = 'Yet another stupid wrapper of icon font.'

s.description = <<-DESC
Expand Down
18 changes: 14 additions & 4 deletions Example/EFIconFont.xcodeproj/project.pbxproj
Expand Up @@ -7,13 +7,15 @@
objects = {

/* Begin PBXBuildFile section */
12476E9D2320E91600BA0EEC /* BaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12476E9C2320E91600BA0EEC /* BaseViewController.swift */; };
12A4AB342245228B003A811F /* SubViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12A4AB332245228A003A811F /* SubViewController.swift */; };
12A4AB3C22467457003A811F /* CGFloat+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12A4AB3B22467457003A811F /* CGFloat+.swift */; };
12A4AB3E224674A0003A811F /* UIDevice+.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12A4AB3D224674A0003A811F /* UIDevice+.swift */; };
12C6769D2246945D00284C0C /* GalleryViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12C6769C2246945D00284C0C /* GalleryViewController.swift */; };
12C6769F2246980100284C0C /* DetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12C6769E2246980100284C0C /* DetailViewController.swift */; };
12E738EA2247544F00AB06B4 /* octicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 12E738E82247544F00AB06B4 /* octicons.ttf */; };
12E738EB2247544F00AB06B4 /* EFIconFontOcticons.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E738E92247544F00AB06B4 /* EFIconFontOcticons.swift */; };
12E9C63E2320B5D000E43E0B /* SearchViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12E9C63D2320B5D000E43E0B /* SearchViewController.swift */; };
26DF1772D0190684DA2BE765 /* Pods_EFIconFont_Example.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FEEBAD6B00651D405D82F932 /* Pods_EFIconFont_Example.framework */; };
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
Expand All @@ -36,6 +38,7 @@

/* Begin PBXFileReference section */
0FEDA834429814FC7822588F /* EFIconFont.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = EFIconFont.podspec; path = ../EFIconFont.podspec; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
12476E9C2320E91600BA0EEC /* BaseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BaseViewController.swift; sourceTree = "<group>"; };
12A4AB292244ADAE003A811F /* README_CN.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README_CN.md; path = ../README_CN.md; sourceTree = "<group>"; };
12A4AB332245228A003A811F /* SubViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubViewController.swift; sourceTree = "<group>"; };
12A4AB3B22467457003A811F /* CGFloat+.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CGFloat+.swift"; sourceTree = "<group>"; };
Expand All @@ -44,6 +47,7 @@
12C6769E2246980100284C0C /* DetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailViewController.swift; sourceTree = "<group>"; };
12E738E82247544F00AB06B4 /* octicons.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = octicons.ttf; sourceTree = "<group>"; };
12E738E92247544F00AB06B4 /* EFIconFontOcticons.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EFIconFontOcticons.swift; sourceTree = "<group>"; };
12E9C63D2320B5D000E43E0B /* SearchViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewController.swift; sourceTree = "<group>"; };
1F42E4C17FD47D6C623654A9 /* Pods-EFIconFont_Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EFIconFont_Example.release.xcconfig"; path = "Target Support Files/Pods-EFIconFont_Example/Pods-EFIconFont_Example.release.xcconfig"; sourceTree = "<group>"; };
44E4152BF7C8A9057EBD9C49 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
5E1D99298753E047EF7A0617 /* Pods-EFIconFont_Tests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-EFIconFont_Tests.debug.xcconfig"; path = "Target Support Files/Pods-EFIconFont_Tests/Pods-EFIconFont_Tests.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -121,10 +125,12 @@
12A4AB3B22467457003A811F /* CGFloat+.swift */,
12A4AB3D224674A0003A811F /* UIDevice+.swift */,
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
12476E9C2320E91600BA0EEC /* BaseViewController.swift */,
607FACD71AFB9204008FA782 /* ViewController.swift */,
12A4AB332245228A003A811F /* SubViewController.swift */,
12C6769E2246980100284C0C /* DetailViewController.swift */,
12C6769C2246945D00284C0C /* GalleryViewController.swift */,
12E9C63D2320B5D000E43E0B /* SearchViewController.swift */,
607FACD31AFB9204008FA782 /* Supporting Files */,
);
name = "Example for EFIconFont";
Expand Down Expand Up @@ -243,11 +249,13 @@
TargetAttributes = {
607FACCF1AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = P3X2725LYY;
LastSwiftMigration = 1020;
ProvisioningStyle = Automatic;
};
607FACE41AFB9204008FA782 = {
CreatedOnToolsVersion = 6.3.1;
DevelopmentTeam = P3X2725LYY;
LastSwiftMigration = 1020;
TestTargetID = 607FACCF1AFB9204008FA782;
};
Expand Down Expand Up @@ -366,7 +374,9 @@
12E738EB2247544F00AB06B4 /* EFIconFontOcticons.swift in Sources */,
12A4AB3C22467457003A811F /* CGFloat+.swift in Sources */,
12A4AB3E224674A0003A811F /* UIDevice+.swift in Sources */,
12E9C63E2320B5D000E43E0B /* SearchViewController.swift in Sources */,
12A4AB342245228B003A811F /* SubViewController.swift in Sources */,
12476E9D2320E91600BA0EEC /* BaseViewController.swift in Sources */,
12C6769D2246945D00284C0C /* GalleryViewController.swift in Sources */,
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
Expand Down Expand Up @@ -526,7 +536,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = P3X2725LYY;
INFOPLIST_FILE = EFIconFont/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
Expand All @@ -544,7 +554,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = P3X2725LYY;
INFOPLIST_FILE = EFIconFont/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MODULE_NAME = ExampleApp;
Expand All @@ -559,7 +569,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 5E1D99298753E047EF7A0617 /* Pods-EFIconFont_Tests.debug.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = P3X2725LYY;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand All @@ -581,7 +591,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = A3381813DC1C34F55DA7AAFA /* Pods-EFIconFont_Tests.release.xcconfig */;
buildSettings = {
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = P3X2725LYY;
FRAMEWORK_SEARCH_PATHS = (
"$(SDKROOT)/Developer/Library/Frameworks",
"$(inherited)",
Expand Down
30 changes: 30 additions & 0 deletions Example/EFIconFont/BaseViewController.swift
@@ -0,0 +1,30 @@
//
// BaseViewController.swift
// EFIconFont_Example
//
// Created by EyreFree on 2019/9/5.
// Copyright © 2019 CocoaPods. All rights reserved.
//

import UIKit

class BaseViewController: UIViewController {

override func viewDidLoad() {
super.viewDidLoad()

automaticallyAdjustsScrollViewInsets = false
}

override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)

removeBackBarButtonTitle()
}

func removeBackBarButtonTitle() {
let returnButtonItem = UIBarButtonItem()
returnButtonItem.title = ""
self.navigationItem.backBarButtonItem = returnButtonItem
}
}
2 changes: 1 addition & 1 deletion Example/EFIconFont/CGFloat+.swift
Expand Up @@ -14,7 +14,7 @@ extension CGFloat {
static let screenHeight = UIScreen.main.bounds.size.height

static let statusBarHeight: CGFloat = 20 + topSafeAreaHeight
static let navigationBarHeight: CGFloat = 44
static let navigationBarHeight: CGFloat = 46
static let statusAndNavigationHeight: CGFloat = statusBarHeight + navigationBarHeight

static let topSafeAreaHeight: CGFloat = UIDevice.isiPhoneX ? 22 : 0
Expand Down
83 changes: 68 additions & 15 deletions Example/EFIconFont/DetailViewController.swift
Expand Up @@ -9,38 +9,91 @@
import UIKit
import EFIconFont

class DetailViewController: UIViewController {

class DetailViewController: BaseViewController {
let icon: EFIconFontProtocol

let imageView: UIImageView = UIImageView()
let textView: UITextView = UITextView()

init(title: String, icon: EFIconFontProtocol) {
self.icon = icon
super.init(nibName: nil, bundle: nil)
self.navigationItem.title = title
navigationItem.title = title
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func viewDidLoad() {
super.viewDidLoad()


self.view.backgroundColor = UIColor.white
self.navigationItem.rightBarButtonItem = UIBarButtonItem(
barButtonSystemItem: UIBarButtonItem.SystemItem.action,
target: self,
action: #selector(shareToSystem)
)
setupControls()
}

func setupControls() {
self.view.backgroundColor = UIColor.white

let imageView = UIImageView()
imageView.frame = CGRect(
x: 12,
y: CGFloat.statusAndNavigationHeight,
width: CGFloat.screenWidth - 24,
height: CGFloat.screenHeight - CGFloat.statusAndNavigationHeight * 2
x: 8,
y: CGFloat.statusAndNavigationHeight + 8,
width: CGFloat.screenWidth - 16,
height: CGFloat.screenWidth - 16
)
imageView.image = icon.image(size: imageView.frame.size, foregroundColor: UIColor.black)
imageView.contentMode = .scaleAspectFit
self.view.addSubview(imageView)

textView.layer.cornerRadius = 8
textView.backgroundColor = UIColor(white: 0.888, alpha: 1)
textView.frame = CGRect(
x: 8,
y: imageView.frame.maxY + 8,
width: CGFloat.screenWidth - 16,
height: CGFloat.screenHeight - imageView.frame.maxY - 16 - CGFloat.bottomSafeAreaHeight
)
textView.isEditable = false
textView.font = UIFont.systemFont(ofSize: 18)
self.view.addSubview(textView)

var infoString: String = ""
let info: [(key: String, value: String)] = [
("", navigationItem.title ?? "Unknown"),
("Unicode", "\(String(format:"0x%02X", icon.unicode.unicodeScalars.first?.value ?? 0))"),
("FontName", icon.name),
("FontFilePath", icon.path)
]

for item in info {
if item.key.isEmpty != false {
infoString += item.value + "\n"
} else {
infoString += "\n" + item.key + ": " + item.value
}
}
textView.text = infoString
}

@objc func shareToSystem() {
guard let imageToShare = imageView.image else { return }
let controller: UIViewController = self
var items: [Any] = [imageToShare]
if let info = textView.text {
items.append(info)
}
let shareVC = UIActivityViewController(activityItems: items, applicationActivities: nil)
shareVC.popoverPresentationController?.sourceView = controller.view
shareVC.popoverPresentationController?.sourceRect = CGRect(
x: controller.view.bounds.size.width / 2.0,
y: controller.view.bounds.size.height / 2.0,
width: 1.0, height: 1.0
)
controller.present(shareVC, animated: true) { [weak self] in
guard let _ = self else { return }
}
}
}
46 changes: 34 additions & 12 deletions Example/EFIconFont/GalleryViewController.swift
Expand Up @@ -9,33 +9,45 @@
import UIKit
import EFIconFont

class GalleryViewController: UIViewController {

class GalleryViewController: BaseViewController {

let name: String
let iconfont: IconFont
let icons: [(key: String, value: EFIconFontProtocol)]

init(title: String, dictionary: [(key: String, value: EFIconFontProtocol)]) {
self.icons = dictionary

init(name: String, iconfont: IconFont) {
self.name = name
self.iconfont = iconfont
self.icons = Array(iconfont.dictionary).sorted(by: { (left, right) -> Bool in
return left.key < right.key
})
super.init(nibName: nil, bundle: nil)
self.navigationItem.title = title
navigationItem.title = iconfont.enum
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func viewDidLoad() {
super.viewDidLoad()


self.view.backgroundColor = UIColor.white
self.navigationItem.rightBarButtonItem = UIBarButtonItem(
barButtonSystemItem: UIBarButtonItem.SystemItem.search,
target: self,
action: #selector(gotoSearch)
)
setupControls()
}

func setupControls() {
let textView = UITextView()
if #available(iOS 11.0, *) {
textView.contentInsetAdjustmentBehavior = .never
}
textView.contentInset = UIEdgeInsets(top: CGFloat.statusAndNavigationHeight, left: 0, bottom: 0, right: 0)
textView.contentOffset = CGPoint(x: 0, y: -CGFloat.statusAndNavigationHeight)
textView.contentInset = UIEdgeInsets(top: 0, left: 0, bottom: CGFloat.bottomSafeAreaHeight, right: 0)
textView.contentOffset = CGPoint(x: 0, y: 0)
textView.isEditable = false
let content: NSMutableAttributedString = NSMutableAttributedString()
for item in icons {
Expand All @@ -44,7 +56,17 @@ class GalleryViewController: UIViewController {
}
}
textView.attributedText = content
textView.frame = CGRect(origin: CGPoint.zero, size: UIScreen.main.bounds.size)
textView.frame = CGRect(
x: 0,
y: CGFloat.statusAndNavigationHeight,
width: CGFloat.screenWidth,
height: CGFloat.screenHeight - CGFloat.statusAndNavigationHeight
)
self.view.addSubview(textView)
}

@objc func gotoSearch() {
let searchViewController: SearchViewController = SearchViewController(iconfonts: [(name, iconfont)])
self.navigationController?.pushViewController(searchViewController, animated: true)
}
}

0 comments on commit abb28be

Please sign in to comment.