Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dnrops
UIFontComplete
提交
845056dc
U
UIFontComplete
项目概览
dnrops
/
UIFontComplete
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
UIFontComplete
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
845056dc
编写于
8月 28, 2017
作者:
N
Nicholas Maccharoli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Alphabetize font enum, remove nonessential code.
上级
5b14f799
变更
3
展开全部
隐藏空白更改
内联
并排
Showing
3 changed file
with
276 addition
and
355 deletion
+276
-355
Sources/Font.swift
Sources/Font.swift
+276
-276
UIFontComplete.xcodeproj/project.pbxproj
UIFontComplete.xcodeproj/project.pbxproj
+0
-12
UIFontComplete/Util/CodeGeneration.swift
UIFontComplete/Util/CodeGeneration.swift
+0
-67
未找到文件。
Sources/Font.swift
浏览文件 @
845056dc
此差异已折叠。
点击以展开。
UIFontComplete.xcodeproj/project.pbxproj
浏览文件 @
845056dc
...
...
@@ -13,7 +13,6 @@
AAE1A29D1E02618D00610C40
/* UIFontComplete.framework in Frameworks */
=
{
isa
=
PBXBuildFile
;
fileRef
=
AAE1A2931E02618D00610C40
/* UIFontComplete.framework */
;
};
AAE1A2A21E02618D00610C40
/* UIFontCompleteTests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
AAE1A2A11E02618D00610C40
/* UIFontCompleteTests.swift */
;
};
AAE1A2A41E02618D00610C40
/* UIFontComplete.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
AAE1A2961E02618D00610C40
/* UIFontComplete.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
AAE1A2B31E027E8100610C40
/* CodeGeneration.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
AAE1A2B21E027E8100610C40
/* CodeGeneration.swift */
;
};
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
...
...
@@ -36,7 +35,6 @@
AAE1A29C1E02618D00610C40
/* UIFontCompleteTests.xctest */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.cfbundle
;
includeInIndex
=
0
;
path
=
UIFontCompleteTests.xctest
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
AAE1A2A11E02618D00610C40
/* UIFontCompleteTests.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
UIFontCompleteTests.swift
;
sourceTree
=
"<group>"
;
};
AAE1A2A31E02618D00610C40
/* Info.plist */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
text.plist.xml
;
path
=
Info.plist
;
sourceTree
=
"<group>"
;
};
AAE1A2B21E027E8100610C40
/* CodeGeneration.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
name
=
CodeGeneration.swift
;
path
=
Util/CodeGeneration.swift
;
sourceTree
=
"<group>"
;
};
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
...
...
@@ -91,7 +89,6 @@
AAE1A2B61E027F4B00610C40
/* Supporting */
,
136122C41EB2AD2A009F45E4
/* Sources */
,
AAE1A2B41E027F1A00610C40
/* Extensions */
,
AAE1A2B11E027E5600610C40
/* Util */
,
);
path
=
UIFontComplete
;
sourceTree
=
"<group>"
;
...
...
@@ -105,14 +102,6 @@
path
=
UIFontCompleteTests
;
sourceTree
=
"<group>"
;
};
AAE1A2B11E027E5600610C40
/* Util */
=
{
isa
=
PBXGroup
;
children
=
(
AAE1A2B21E027E8100610C40
/* CodeGeneration.swift */
,
);
name
=
Util
;
sourceTree
=
"<group>"
;
};
AAE1A2B41E027F1A00610C40
/* Extensions */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -243,7 +232,6 @@
AA813B591F0092450096ABBD
/* FontRepresentable.swift in Sources */
,
AA813B581F0092450096ABBD
/* Font.swift in Sources */
,
AA813B5A1F0092450096ABBD
/* UIFont+Extension.swift in Sources */
,
AAE1A2B31E027E8100610C40
/* CodeGeneration.swift in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
UIFontComplete/Util/CodeGeneration.swift
已删除
100644 → 0
浏览文件 @
5b14f799
//
// CodeGeneration.swift
// UIFontComplete
//
// Created by Nicholas Maccharoli on 2016/12/15.
//
//
import
Foundation
import
UIKit
extension
String
{
fileprivate
var
enumified
:
String
{
let
hyphenless
=
self
.
replacingOccurrences
(
of
:
"-"
,
with
:
""
)
return
String
(
hyphenless
.
characters
.
first
!
)
.
lowercased
()
+
String
(
hyphenless
.
characters
.
dropFirst
())
}
}
enum
FontCase
{
case
family
(
String
)
case
name
(
String
,
String
)
}
func
createEnumNamesAndCases
()
->
[
FontCase
]
{
var
fontData
=
[
FontCase
]()
for
family
in
UIFont
.
familyNames
where
!
UIFont
.
fontNames
(
forFamilyName
:
family
)
.
isEmpty
{
fontData
+=
[
FontCase
.
family
(
family
)]
for
font
in
UIFont
.
fontNames
(
forFamilyName
:
family
)
{
fontData
+=
[
FontCase
.
name
(
font
.
enumified
,
font
)]
}
}
return
fontData
}
func
createEnum
(
with
fonts
:
[
FontCase
],
spacing
:
Int
=
4
,
familyComment
:
Bool
=
true
)
->
String
{
var
outputString
=
""
let
indent
=
(
0
..<
spacing
)
.
map
({
_
in
" "
})
.
joined
()
for
fontItem
in
fonts
{
switch
fontItem
{
case
.
family
(
let
familyName
)
where
familyComment
:
outputString
+=
"
\n\n
"
+
indent
+
"// Font Family: "
+
familyName
case
.
name
(
let
enumCaseName
,
let
fontString
):
outputString
+=
"
\n
"
+
indent
+
"case "
+
enumCaseName
+
" =
\"\(
fontString
)\"
"
default
:
break
}
}
return
"public enum Font: String {"
+
outputString
+
"
\n
}"
}
func
makeTestCases
(
with
fonts
:
[
FontCase
])
->
String
{
func
makeTestCase
(
fontInfo
:
FontCase
)
->
String
?
{
switch
fontInfo
{
case
.
name
(
let
enumName
,
let
fontString
):
return
"func testFont"
+
enumName
.
capitalized
+
"() {
\n
"
+
" XCTAssert(UIFont(font: ."
+
enumName
+
", size: 12.0) != nil,"
+
"
\"
Font
\\\"\(
fontString
)\\\"
can not be found.
\"
)"
+
"
\n
}"
default
:
return
nil
}
}
let
results
=
fonts
.
flatMap
{
makeTestCase
(
fontInfo
:
$0
)
}
return
results
.
joined
(
separator
:
"
\n\n
"
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录