-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
222 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
# | ||
# Be sure to run `pod spec lint DPFlowCoordinator.podspec' to ensure this is a | ||
# valid spec and to remove all comments including this before submitting the spec. | ||
# | ||
# To learn more about Podspec attributes see http://docs.cocoapods.org/specification.html | ||
# To see working Podspecs in the CocoaPods repo see https://github.com/CocoaPods/Specs/ | ||
# | ||
|
||
Pod::Spec.new do |s| | ||
|
||
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# These will help people to find your library, and whilst it | ||
# can feel like a chore to fill in it's definitely to your advantage. The | ||
# summary should be tweet-length, and the description more in depth. | ||
# | ||
|
||
s.name = "DPStyle" | ||
s.version = "1.0.1" | ||
s.summary = "iOS样式相关工具" | ||
|
||
# This description is used to generate tags and improve search results. | ||
# * Think: What does it do? Why did you write it? What is the focus? | ||
# * Try to keep it short, snappy and to the point. | ||
# * Write the description between the DESC delimiters below. | ||
# * Finally, don't worry about the indent, CocoaPods strips it! | ||
s.description = <<-DESC | ||
iOS样式相关工具,封装了颜色和字体的相关方法 | ||
DESC | ||
|
||
s.homepage = "http://dpdev.cn/" | ||
# s.screenshots = "www.example.com/screenshots_1.gif", "www.example.com/screenshots_2.gif" | ||
|
||
|
||
# ――― Spec License ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# Licensing your code is important. See http://choosealicense.com for more info. | ||
# CocoaPods will detect a license file if there is a named LICENSE* | ||
# Popular ones are 'MIT', 'BSD' and 'Apache License, Version 2.0'. | ||
# | ||
|
||
s.license = "MIT" | ||
# s.license = { :type => "MIT", :file => "FILE_LICENSE" } | ||
|
||
|
||
# ――― Author Metadata ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# Specify the authors of the library, with email addresses. Email addresses | ||
# of the authors are extracted from the SCM log. E.g. $ git log. CocoaPods also | ||
# accepts just a name if you'd rather not provide an email address. | ||
# | ||
# Specify a social_media_url where others can refer to, for example a twitter | ||
# profile URL. | ||
# | ||
|
||
s.author = { "DancewithPeng" => "[email protected]" } | ||
# Or just: s.author = "DancewithPeng" | ||
# s.authors = { "DancewithPeng" => "[email protected]" } | ||
# s.social_media_url = "http://twitter.com/DancewithPeng" | ||
|
||
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# If this Pod runs only on iOS or OS X, then specify the platform and | ||
# the deployment target. You can optionally include the target after the platform. | ||
# | ||
|
||
# s.platform = :ios | ||
s.platform = :ios, "9.0" | ||
|
||
# When using multiple platforms | ||
# s.ios.deployment_target = "5.0" | ||
# s.osx.deployment_target = "10.7" | ||
# s.watchos.deployment_target = "2.0" | ||
# s.tvos.deployment_target = "9.0" | ||
|
||
# ――― Language ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
s.swift_version = "4.0" | ||
|
||
# ――― Source Location ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# Specify the location from where the source should be retrieved. | ||
# Supports git, hg, bzr, svn and HTTP. | ||
# | ||
|
||
s.source = { :git => "https://github.com/DancewithPeng/DPStyle.git", :tag => "#{s.version}" } | ||
|
||
|
||
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# CocoaPods is smart about how it includes source code. For source files | ||
# giving a folder will include any swift, h, m, mm, c & cpp files. | ||
# For header files it will include any header in the folder. | ||
# Not including the public_header_files will make all headers public. | ||
# | ||
|
||
s.source_files = "DPStyle/DPStyle/Source/*.{swift}" | ||
# s.exclude_files = "Classes/Exclude" | ||
|
||
# s.public_header_files = "Classes/**/*.h" | ||
|
||
|
||
# ――― Resources ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# A list of resources included with the Pod. These are copied into the | ||
# target bundle with a build phase script. Anything else will be cleaned. | ||
# You can preserve files from being cleaned, please don't preserve | ||
# non-essential files like tests, examples and documentation. | ||
# | ||
|
||
# s.resource = "icon.png" | ||
# s.resources = "Resources/*.png" | ||
|
||
# s.preserve_paths = "FilesToSave", "MoreFilesToSave" | ||
|
||
|
||
# ――― Project Linking ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# Link your library with frameworks, or libraries. Libraries do not include | ||
# the lib prefix of their name. | ||
# | ||
|
||
# s.framework = "DPFlowCoordinator" | ||
# s.frameworks = "SomeFramework", "AnotherFramework" | ||
|
||
# s.library = "iconv" | ||
# s.libraries = "iconv", "xml2" | ||
|
||
|
||
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― # | ||
# | ||
# If your library depends on compiler flags you can set them in the xcconfig hash | ||
# where they will only apply to your library. If you depend on other Podspecs | ||
# you can include multiple dependencies to ensure it works. | ||
|
||
# s.requires_arc = true | ||
|
||
# s.xcconfig = { "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2" } | ||
# s.dependency "JSONKit", "~> 1.4" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,20 @@ | |
// Copyright © 2018年 [email protected]. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import UIKit.UIColor | ||
|
||
// MARK: - Hex Handing | ||
|
||
// UIColor的扩展,提供16进制色值设置 | ||
public extension UIColor { | ||
|
||
private convenience init?(hex: Int, alpha: CGFloat = 1) { | ||
|
||
/// 根据16进制色值创建颜色对象的便捷方法 | ||
/// | ||
/// - Parameters: | ||
/// - hex: 16进制颜色值 | ||
/// - alpha: 不透明度 | ||
/// - Returns: 返回对应16进制色值的颜色 | ||
public convenience init?(hex: UInt, alpha: CGFloat = 1) { | ||
|
||
guard 0x000000...0xFFFFFF ~= hex else { | ||
return nil | ||
|
@@ -31,7 +39,7 @@ public extension UIColor { | |
/// - hex: 16进制颜色值 | ||
/// - alpha: 不透明度 | ||
/// - Returns: 返回对应16进制色值的颜色 | ||
public static func hex(_ hex: Int, alpha: CGFloat = 1) -> UIColor? { | ||
public static func hex(_ hex: UInt, alpha: CGFloat = 1) -> UIColor? { | ||
return UIColor(hex: hex, alpha: alpha) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,64 +6,55 @@ | |
// Copyright © 2018年 [email protected]. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import UIKit.UIFont | ||
|
||
|
||
/// 字重,为了封装size方法 | ||
public class DPWeight { | ||
|
||
/// 对应的UIFont的字重 | ||
private let weight: UIFont.Weight | ||
|
||
/// 初始化方法,根据UIFont字重来初始化 | ||
/// | ||
/// - Parameter weight: UIFont的字重 | ||
init(weight: UIFont.Weight) { | ||
self.weight = weight | ||
} | ||
|
||
/// 返回对应字号的系统字体 | ||
/// | ||
/// - Parameter size: 字号 | ||
/// - Returns: 返回对应字号的系统字体 | ||
public func size(_ size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: weight) | ||
} | ||
} | ||
|
||
|
||
// MARK: - 对应的字重 | ||
// MARK: - 返回各种字重的UIFont便捷方法 | ||
public extension UIFont { | ||
|
||
/// 标准体 | ||
public static let regular = DPWeight(weight: .regular) | ||
public static func regular(size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: .regular) | ||
} | ||
|
||
/// 超轻体 | ||
public static let ultraLight = DPWeight(weight: .ultraLight) | ||
public static func ultraLight(size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: .ultraLight) | ||
} | ||
|
||
/// 细体 | ||
public static let thin = DPWeight(weight: .thin) | ||
public static func thin(size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: .thin) | ||
} | ||
|
||
/// 轻体 | ||
public static let light = DPWeight(weight: .light) | ||
public static func light(size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: .light) | ||
} | ||
|
||
/// 中体 | ||
public static let medium = DPWeight(weight: .medium) | ||
public static func medium(size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: .medium) | ||
} | ||
|
||
/// 半粗体 | ||
public static let semibold = DPWeight(weight: .semibold) | ||
public static func semibold(size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: .semibold) | ||
} | ||
|
||
/// 粗体 | ||
public static let bold = DPWeight(weight: .bold) | ||
public static func bold(size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: .bold) | ||
} | ||
|
||
/// 重体 | ||
public static let heavy = DPWeight(weight: .heavy) | ||
public static func heavy(size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: .heavy) | ||
} | ||
|
||
/// 黑体 | ||
public static let black = DPWeight(weight: .black) | ||
|
||
public static func medium(size: CGFloat) -> UIFont { | ||
return medium.size(size) | ||
public static func black(size: CGFloat) -> UIFont { | ||
return UIFont.systemFont(ofSize: size, weight: .black) | ||
} | ||
} | ||
|
||
|
@@ -76,7 +67,7 @@ public extension UIFont { | |
/// - Parameter size: 对应的字号 | ||
/// - Returns: 返回对应字号的系统字体,字重为标准体 | ||
public static func size(_ size: CGFloat) -> UIFont { | ||
return regular.size(size) | ||
return regular(size: size) | ||
} | ||
} | ||
|
Oops, something went wrong.