├── .swift-version
├── KYDigitalFontView.xcodeproj
├── project.xcworkspace
│ └── contents.xcworkspacedata
├── xcshareddata
│ └── xcschemes
│ │ └── KYDigitalFontView.xcscheme
└── project.pbxproj
├── KYDigitalFontView
├── KYDigitalFontView.h
├── Info.plist
└── Classes
│ └── KYDigitalFontView.swift
├── KYDigitalFontView.podspec
├── .gitignore
├── Example
├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ └── Contents.json
├── Info.plist
├── Base.lproj
│ └── LaunchScreen.storyboard
├── AppDelegate.swift
├── ViewController.swift
└── Main.storyboard
├── LICENSE
└── README.md
/.swift-version:
--------------------------------------------------------------------------------
1 | 3.0
2 |
--------------------------------------------------------------------------------
/KYDigitalFontView.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/KYDigitalFontView/KYDigitalFontView.h:
--------------------------------------------------------------------------------
1 | //
2 | // KYDigitalFontView.h
3 | // KYDigitalFontView
4 | //
5 | // Created by kyo__hei on 2016/09/19.
6 | // Copyright © 2016年 kyo__hei. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | //! Project version number for KYDigitalFontView.
12 | FOUNDATION_EXPORT double KYDigitalFontViewVersionNumber;
13 |
14 | //! Project version string for KYDigitalFontView.
15 | FOUNDATION_EXPORT const unsigned char KYDigitalFontViewVersionString[];
16 |
17 | // In this header, you should import all the public headers of your framework using statements like #import
18 |
19 |
20 |
--------------------------------------------------------------------------------
/KYDigitalFontView.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | s.name = "KYDigitalFontView"
3 | s.version = "2.0.0"
4 | s.summary = "KYDigitalFontView is a custom view that displays the character in the digital font style."
5 | s.homepage = "https://github.com/ykyouhei/KYDigitalFontView"
6 | s.license = "MIT"
7 | s.author = { "Kyohei Yamaguchi" => "kyouhei.lab@gmail.com" }
8 | s.social_media_url = "https://twitter.com/kyo__hei"
9 | s.platform = :ios, '7.0'
10 | s.source = { :git => "https://github.com/ykyouhei/KYDigitalFontView.git", :tag => s.version.to_s }
11 | s.source_files = "KYDigitalFontView/Classes/*.swift"
12 | s.requires_arc = true
13 | s.ios.deployment_target = '8.0'
14 | end
15 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | build/
4 | *.pbxuser
5 | !default.pbxuser
6 | *.mode1v3
7 | !default.mode1v3
8 | *.mode2v3
9 | !default.mode2v3
10 | *.perspectivev3
11 | !default.perspectivev3
12 | xcuserdata
13 | *.xccheckout
14 | *.moved-aside
15 | DerivedData
16 | *.hmap
17 | *.ipa
18 | *.xcuserstate
19 |
20 | # CocoaPods
21 | #
22 | # We recommend against adding the Pods directory to your .gitignore. However
23 | # you should judge for yourself, the pros and cons are mentioned at:
24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control
25 | #
26 | # Pods/
27 |
28 | # Carthage
29 | #
30 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
31 | # Carthage/Checkouts
32 |
33 | Carthage/Build
34 |
--------------------------------------------------------------------------------
/Example/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "29x29",
11 | "scale" : "3x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "40x40",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "size" : "40x40",
21 | "scale" : "3x"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "size" : "60x60",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "size" : "60x60",
31 | "scale" : "3x"
32 | }
33 | ],
34 | "info" : {
35 | "version" : 1,
36 | "author" : "xcode"
37 | }
38 | }
--------------------------------------------------------------------------------
/KYDigitalFontView/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 2.0.0
19 | CFBundleVersion
20 | $(CURRENT_PROJECT_VERSION)
21 | NSPrincipalClass
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Kyohei Yamaguchi
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/Example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UILaunchStoryboardName
24 | LaunchScreen
25 | UIMainStoryboardFile
26 | Main
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Example/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Example/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Example
4 | //
5 | // Created by kyo__hei on 2016/09/19.
6 | // Copyright © 2016年 kyo__hei. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | @UIApplicationMain
12 | class AppDelegate: UIResponder, UIApplicationDelegate {
13 |
14 | var window: UIWindow?
15 |
16 |
17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18 | // Override point for customization after application launch.
19 | return true
20 | }
21 |
22 | func applicationWillResignActive(_ application: UIApplication) {
23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
25 | }
26 |
27 | func applicationDidEnterBackground(_ application: UIApplication) {
28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
30 | }
31 |
32 | func applicationWillEnterForeground(_ application: UIApplication) {
33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | func applicationDidBecomeActive(_ application: UIApplication) {
37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
38 | }
39 |
40 | func applicationWillTerminate(_ application: UIApplication) {
41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
42 | }
43 |
44 |
45 | }
46 |
47 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # KYDigitalFontView
2 |
3 | [](https://github.com/Carthage/Carthage)
4 | [](http://cocoadocs.org/docsets/KYDigitalFontView/)
5 | [](http://cocoadocs.org/docsets/KYDigitalFontView/)
6 | [](https://github.com/ykyohei/KYDigitalFontView/blob/master/LICENSE)
7 | 
8 |
9 | `KYDigitalFontView` is a custom view that displays the character in the digital font style
10 |
11 | * IBDesignable, IBInspectable Support
12 |
13 |
14 |  
15 |
16 |
17 | ## Installation
18 |
19 | ### CocoaPods
20 |
21 | `KYDigitalFontView ` is available on CocoaPods.
22 | Add the following to your `Podfile`:
23 |
24 | ```ruby
25 | pod 'KYDigitalFontView'
26 | ```
27 |
28 | ### Manually
29 | Just add the Classes folder to your project.
30 |
31 |
32 | ## Usage
33 | (see sample Xcode project in `/Example`)
34 |
35 | ### Code
36 |
37 | ```Swift
38 | let digitalFontView = KYDigitalFontView(frame: CGRectMake(10, 10, 100, 160))
39 |
40 | digitalFontView.borderWidth = 1
41 | digitalFontView.borderColor = UIColor.redColor()
42 | digitalFontView.fillColor = UIColor.cyanColor()
43 | digitalFontView.lineWidth = 15
44 | digitalFontView.drawPositions = KYDigitalFontView.DrawPositions(character: "A")
45 |
46 | /* Custom Drawing
47 | digitalFontView.drawPositions = [._0, ._1, ._14, ._15]
48 | */
49 |
50 | view.addSubview(v)
51 | ```
52 |
53 | ### Storyboard
54 |
55 | 
56 |
57 |
58 | ### Drawing Character
59 | ```Swift
60 | // From Character
61 | digitalFontView.drawPositions = KYDigitalFontView.DrawPositions(character: "A")
62 |
63 | // Custom Drawing
64 | digitalFontView.drawPositions = [._0, ._1, ._2]
65 | ```
66 |
67 | #### Supported Characters
68 | * a~z
69 | * A~Z
70 | * 0-9
71 | * $, +, -, *, /, =, %, \, ", ', #, @, &, _, [, ], (, ), {, }, <, >, `, ^, ~
72 |
73 | #### Custom Drawing
74 |
75 | 
76 |
77 |
78 |
79 | ## License
80 |
81 | This code is distributed under the terms and conditions of the [MIT license](LICENSE).
--------------------------------------------------------------------------------
/KYDigitalFontView.xcodeproj/xcshareddata/xcschemes/KYDigitalFontView.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
34 |
35 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
63 |
64 |
70 |
71 |
72 |
73 |
75 |
76 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Example/ViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.swift
3 | // Example
4 | //
5 | // Created by kyo__hei on 2016/09/19.
6 | // Copyright © 2016年 kyo__hei. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import KYDigitalFontView
11 |
12 | class ViewController: UIViewController, UITextFieldDelegate {
13 |
14 | /**************************************************************************/
15 | // MARK: - Properties
16 | /**************************************************************************/
17 |
18 | @IBOutlet fileprivate weak var _digitalFontView : KYDigitalFontView!
19 | @IBOutlet fileprivate weak var _bottomConstraint: NSLayoutConstraint!
20 | @IBOutlet fileprivate weak var _textField : UITextField!
21 |
22 | override func viewDidLoad() {
23 | super.viewDidLoad()
24 | // Do any additional setup after loading the view, typically from a nib.
25 | _digitalFontView.drawPositions = .All
26 |
27 | NotificationCenter
28 | .default
29 | .addObserver(self,
30 | selector: #selector(ViewController.keyboardWillShowNotification(_:)),
31 | name: NSNotification.Name.UIKeyboardWillShow,
32 | object: nil
33 | )
34 | NotificationCenter
35 | .default
36 | .addObserver(self,
37 | selector: #selector(ViewController.keyboardWillHideNotification(_:)),
38 | name: NSNotification.Name.UIKeyboardWillHide,
39 | object: nil
40 | )
41 | }
42 |
43 | deinit {
44 | NotificationCenter.default.removeObserver(self)
45 | }
46 |
47 |
48 | /**************************************************************************/
49 | // MARK: - Notification
50 | /**************************************************************************/
51 |
52 | func keyboardWillShowNotification(_ notification: Notification) {
53 | if let keyboardFrame = ((notification as NSNotification).userInfo?[UIKeyboardFrameEndUserInfoKey] as AnyObject).cgRectValue,
54 | let duration = ((notification as NSNotification).userInfo?[UIKeyboardAnimationDurationUserInfoKey] as AnyObject).doubleValue
55 | {
56 | self._bottomConstraint.constant += keyboardFrame.height
57 | UIView.animate(withDuration: duration, animations: { () -> Void in
58 | self.view.layoutIfNeeded()
59 | })
60 | }
61 | }
62 |
63 | func keyboardWillHideNotification(_ notification: Notification) {
64 | if let keyboardFrame = ((notification as NSNotification).userInfo?[UIKeyboardFrameEndUserInfoKey] as AnyObject).cgRectValue,
65 | let duration = ((notification as NSNotification).userInfo?[UIKeyboardAnimationDurationUserInfoKey] as AnyObject).doubleValue
66 | {
67 | self._bottomConstraint.constant -= keyboardFrame.height
68 | UIView.animate(withDuration: duration, animations: { () -> Void in
69 | self.view.layoutIfNeeded()
70 | })
71 | }
72 | }
73 |
74 | /**************************************************************************/
75 | // MARK: - Action
76 | /**************************************************************************/
77 |
78 | @IBAction func handleValueChaned(_ sender: UISwitch) {
79 | let drawPosition: KYDigitalFontView.DrawPositions
80 | switch sender.tag - 1 {
81 | case 0:
82 | drawPosition = ._0
83 | case 1:
84 | drawPosition = ._1
85 | case 2:
86 | drawPosition = ._2
87 | case 3:
88 | drawPosition = ._3
89 | case 4:
90 | drawPosition = ._4
91 | case 5:
92 | drawPosition = ._5
93 | case 6:
94 | drawPosition = ._6
95 | case 7:
96 | drawPosition = ._7
97 | case 8:
98 | drawPosition = ._8
99 | case 9:
100 | drawPosition = ._9
101 | case 10:
102 | drawPosition = ._10
103 | case 11:
104 | drawPosition = ._11
105 | case 12:
106 | drawPosition = ._12
107 | case 13:
108 | drawPosition = ._13
109 | case 14:
110 | drawPosition = ._14
111 | case 15:
112 | drawPosition = ._15
113 | default:
114 | drawPosition = ._0
115 | break
116 | }
117 | if sender.isOn {
118 | _digitalFontView.drawPositions.update(with: drawPosition)
119 | } else {
120 | _digitalFontView.drawPositions.remove(drawPosition)
121 | }
122 | }
123 |
124 | @IBAction func handleTap(_ sender: UITapGestureRecognizer) {
125 | _textField.resignFirstResponder()
126 | }
127 |
128 | /**************************************************************************/
129 | // MARK: - TextFieldDelegate
130 | /**************************************************************************/
131 |
132 | func textFieldDidEndEditing(_ textField: UITextField) {
133 | if (textField.text?.isEmpty)! {
134 | return
135 | }
136 | let char = textField.text!.characters.first!
137 | _digitalFontView.drawPositions = KYDigitalFontView.DrawPositions(character: char)
138 |
139 | (view.viewWithTag(1) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._0])
140 | (view.viewWithTag(2) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._1])
141 | (view.viewWithTag(3) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._2])
142 | (view.viewWithTag(4) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._3])
143 | (view.viewWithTag(5) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._4])
144 | (view.viewWithTag(6) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._5])
145 | (view.viewWithTag(7) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._6])
146 | (view.viewWithTag(8) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._7])
147 | (view.viewWithTag(9) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._8])
148 | (view.viewWithTag(10) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._9])
149 | (view.viewWithTag(11) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._10])
150 | (view.viewWithTag(12) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._11])
151 | (view.viewWithTag(13) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._12])
152 | (view.viewWithTag(14) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._13])
153 | (view.viewWithTag(15) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._14])
154 | (view.viewWithTag(16) as! UISwitch).isOn = _digitalFontView.drawPositions.contains([._15])
155 | }
156 |
157 | func textFieldShouldReturn(_ textField: UITextField) -> Bool {
158 | textField.resignFirstResponder()
159 | textField.text = ""
160 | return true
161 | }
162 |
163 | }
164 |
--------------------------------------------------------------------------------
/KYDigitalFontView.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 4117DA261D8FBA4F00A2C652 /* KYDigitalFontView.h in Headers */ = {isa = PBXBuildFile; fileRef = 4117DA241D8FBA4F00A2C652 /* KYDigitalFontView.h */; settings = {ATTRIBUTES = (Public, ); }; };
11 | 4117DA2E1D8FBAD600A2C652 /* KYDigitalFontView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4117DA2D1D8FBAD600A2C652 /* KYDigitalFontView.swift */; };
12 | 4117DA621D8FBC1200A2C652 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4117DA611D8FBC1200A2C652 /* AppDelegate.swift */; };
13 | 4117DA641D8FBC1200A2C652 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4117DA631D8FBC1200A2C652 /* ViewController.swift */; };
14 | 4117DA691D8FBC1200A2C652 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4117DA681D8FBC1200A2C652 /* Assets.xcassets */; };
15 | 4117DA6C1D8FBC1200A2C652 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4117DA6A1D8FBC1200A2C652 /* LaunchScreen.storyboard */; };
16 | 4117DA711D8FBC8600A2C652 /* KYDigitalFontView.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4117DA211D8FBA4F00A2C652 /* KYDigitalFontView.framework */; };
17 | 4117DA721D8FBC8600A2C652 /* KYDigitalFontView.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 4117DA211D8FBA4F00A2C652 /* KYDigitalFontView.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
18 | 4117DA771D8FC87100A2C652 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 4117DA761D8FC87100A2C652 /* Main.storyboard */; };
19 | /* End PBXBuildFile section */
20 |
21 | /* Begin PBXContainerItemProxy section */
22 | 4117DA731D8FBC8600A2C652 /* PBXContainerItemProxy */ = {
23 | isa = PBXContainerItemProxy;
24 | containerPortal = 4117DA181D8FBA4F00A2C652 /* Project object */;
25 | proxyType = 1;
26 | remoteGlobalIDString = 4117DA201D8FBA4F00A2C652;
27 | remoteInfo = KYDigitalFontView;
28 | };
29 | /* End PBXContainerItemProxy section */
30 |
31 | /* Begin PBXCopyFilesBuildPhase section */
32 | 4117DA751D8FBC8600A2C652 /* Embed Frameworks */ = {
33 | isa = PBXCopyFilesBuildPhase;
34 | buildActionMask = 2147483647;
35 | dstPath = "";
36 | dstSubfolderSpec = 10;
37 | files = (
38 | 4117DA721D8FBC8600A2C652 /* KYDigitalFontView.framework in Embed Frameworks */,
39 | );
40 | name = "Embed Frameworks";
41 | runOnlyForDeploymentPostprocessing = 0;
42 | };
43 | /* End PBXCopyFilesBuildPhase section */
44 |
45 | /* Begin PBXFileReference section */
46 | 4117DA211D8FBA4F00A2C652 /* KYDigitalFontView.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = KYDigitalFontView.framework; sourceTree = BUILT_PRODUCTS_DIR; };
47 | 4117DA241D8FBA4F00A2C652 /* KYDigitalFontView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KYDigitalFontView.h; sourceTree = ""; };
48 | 4117DA251D8FBA4F00A2C652 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
49 | 4117DA2D1D8FBAD600A2C652 /* KYDigitalFontView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KYDigitalFontView.swift; sourceTree = ""; };
50 | 4117DA5F1D8FBC1200A2C652 /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
51 | 4117DA611D8FBC1200A2C652 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
52 | 4117DA631D8FBC1200A2C652 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; };
53 | 4117DA681D8FBC1200A2C652 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
54 | 4117DA6B1D8FBC1200A2C652 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
55 | 4117DA6D1D8FBC1200A2C652 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
56 | 4117DA761D8FC87100A2C652 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = ""; };
57 | /* End PBXFileReference section */
58 |
59 | /* Begin PBXFrameworksBuildPhase section */
60 | 4117DA1D1D8FBA4F00A2C652 /* Frameworks */ = {
61 | isa = PBXFrameworksBuildPhase;
62 | buildActionMask = 2147483647;
63 | files = (
64 | );
65 | runOnlyForDeploymentPostprocessing = 0;
66 | };
67 | 4117DA5C1D8FBC1200A2C652 /* Frameworks */ = {
68 | isa = PBXFrameworksBuildPhase;
69 | buildActionMask = 2147483647;
70 | files = (
71 | 4117DA711D8FBC8600A2C652 /* KYDigitalFontView.framework in Frameworks */,
72 | );
73 | runOnlyForDeploymentPostprocessing = 0;
74 | };
75 | /* End PBXFrameworksBuildPhase section */
76 |
77 | /* Begin PBXGroup section */
78 | 4117DA171D8FBA4F00A2C652 = {
79 | isa = PBXGroup;
80 | children = (
81 | 4117DA231D8FBA4F00A2C652 /* KYDigitalFontView */,
82 | 4117DA601D8FBC1200A2C652 /* Example */,
83 | 4117DA221D8FBA4F00A2C652 /* Products */,
84 | );
85 | sourceTree = "";
86 | };
87 | 4117DA221D8FBA4F00A2C652 /* Products */ = {
88 | isa = PBXGroup;
89 | children = (
90 | 4117DA211D8FBA4F00A2C652 /* KYDigitalFontView.framework */,
91 | 4117DA5F1D8FBC1200A2C652 /* Example.app */,
92 | );
93 | name = Products;
94 | sourceTree = "";
95 | };
96 | 4117DA231D8FBA4F00A2C652 /* KYDigitalFontView */ = {
97 | isa = PBXGroup;
98 | children = (
99 | 4117DA2C1D8FBAB900A2C652 /* Classes */,
100 | 4117DA241D8FBA4F00A2C652 /* KYDigitalFontView.h */,
101 | 4117DA251D8FBA4F00A2C652 /* Info.plist */,
102 | );
103 | path = KYDigitalFontView;
104 | sourceTree = "";
105 | };
106 | 4117DA2C1D8FBAB900A2C652 /* Classes */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 4117DA2D1D8FBAD600A2C652 /* KYDigitalFontView.swift */,
110 | );
111 | path = Classes;
112 | sourceTree = "";
113 | };
114 | 4117DA601D8FBC1200A2C652 /* Example */ = {
115 | isa = PBXGroup;
116 | children = (
117 | 4117DA611D8FBC1200A2C652 /* AppDelegate.swift */,
118 | 4117DA631D8FBC1200A2C652 /* ViewController.swift */,
119 | 4117DA761D8FC87100A2C652 /* Main.storyboard */,
120 | 4117DA681D8FBC1200A2C652 /* Assets.xcassets */,
121 | 4117DA6A1D8FBC1200A2C652 /* LaunchScreen.storyboard */,
122 | 4117DA6D1D8FBC1200A2C652 /* Info.plist */,
123 | );
124 | path = Example;
125 | sourceTree = "";
126 | };
127 | /* End PBXGroup section */
128 |
129 | /* Begin PBXHeadersBuildPhase section */
130 | 4117DA1E1D8FBA4F00A2C652 /* Headers */ = {
131 | isa = PBXHeadersBuildPhase;
132 | buildActionMask = 2147483647;
133 | files = (
134 | 4117DA261D8FBA4F00A2C652 /* KYDigitalFontView.h in Headers */,
135 | );
136 | runOnlyForDeploymentPostprocessing = 0;
137 | };
138 | /* End PBXHeadersBuildPhase section */
139 |
140 | /* Begin PBXNativeTarget section */
141 | 4117DA201D8FBA4F00A2C652 /* KYDigitalFontView */ = {
142 | isa = PBXNativeTarget;
143 | buildConfigurationList = 4117DA291D8FBA4F00A2C652 /* Build configuration list for PBXNativeTarget "KYDigitalFontView" */;
144 | buildPhases = (
145 | 4117DA1C1D8FBA4F00A2C652 /* Sources */,
146 | 4117DA1D1D8FBA4F00A2C652 /* Frameworks */,
147 | 4117DA1E1D8FBA4F00A2C652 /* Headers */,
148 | 4117DA1F1D8FBA4F00A2C652 /* Resources */,
149 | );
150 | buildRules = (
151 | );
152 | dependencies = (
153 | );
154 | name = KYDigitalFontView;
155 | productName = KYDigitalFontView;
156 | productReference = 4117DA211D8FBA4F00A2C652 /* KYDigitalFontView.framework */;
157 | productType = "com.apple.product-type.framework";
158 | };
159 | 4117DA5E1D8FBC1200A2C652 /* Example */ = {
160 | isa = PBXNativeTarget;
161 | buildConfigurationList = 4117DA6E1D8FBC1200A2C652 /* Build configuration list for PBXNativeTarget "Example" */;
162 | buildPhases = (
163 | 4117DA5B1D8FBC1200A2C652 /* Sources */,
164 | 4117DA5C1D8FBC1200A2C652 /* Frameworks */,
165 | 4117DA5D1D8FBC1200A2C652 /* Resources */,
166 | 4117DA751D8FBC8600A2C652 /* Embed Frameworks */,
167 | );
168 | buildRules = (
169 | );
170 | dependencies = (
171 | 4117DA741D8FBC8600A2C652 /* PBXTargetDependency */,
172 | );
173 | name = Example;
174 | productName = Example;
175 | productReference = 4117DA5F1D8FBC1200A2C652 /* Example.app */;
176 | productType = "com.apple.product-type.application";
177 | };
178 | /* End PBXNativeTarget section */
179 |
180 | /* Begin PBXProject section */
181 | 4117DA181D8FBA4F00A2C652 /* Project object */ = {
182 | isa = PBXProject;
183 | attributes = {
184 | LastSwiftUpdateCheck = 0800;
185 | LastUpgradeCheck = 0800;
186 | ORGANIZATIONNAME = kyo__hei;
187 | TargetAttributes = {
188 | 4117DA201D8FBA4F00A2C652 = {
189 | CreatedOnToolsVersion = 8.0;
190 | LastSwiftMigration = 0800;
191 | ProvisioningStyle = Automatic;
192 | };
193 | 4117DA5E1D8FBC1200A2C652 = {
194 | CreatedOnToolsVersion = 8.0;
195 | LastSwiftMigration = 0800;
196 | ProvisioningStyle = Automatic;
197 | };
198 | };
199 | };
200 | buildConfigurationList = 4117DA1B1D8FBA4F00A2C652 /* Build configuration list for PBXProject "KYDigitalFontView" */;
201 | compatibilityVersion = "Xcode 3.2";
202 | developmentRegion = English;
203 | hasScannedForEncodings = 0;
204 | knownRegions = (
205 | en,
206 | Base,
207 | );
208 | mainGroup = 4117DA171D8FBA4F00A2C652;
209 | productRefGroup = 4117DA221D8FBA4F00A2C652 /* Products */;
210 | projectDirPath = "";
211 | projectRoot = "";
212 | targets = (
213 | 4117DA201D8FBA4F00A2C652 /* KYDigitalFontView */,
214 | 4117DA5E1D8FBC1200A2C652 /* Example */,
215 | );
216 | };
217 | /* End PBXProject section */
218 |
219 | /* Begin PBXResourcesBuildPhase section */
220 | 4117DA1F1D8FBA4F00A2C652 /* Resources */ = {
221 | isa = PBXResourcesBuildPhase;
222 | buildActionMask = 2147483647;
223 | files = (
224 | );
225 | runOnlyForDeploymentPostprocessing = 0;
226 | };
227 | 4117DA5D1D8FBC1200A2C652 /* Resources */ = {
228 | isa = PBXResourcesBuildPhase;
229 | buildActionMask = 2147483647;
230 | files = (
231 | 4117DA771D8FC87100A2C652 /* Main.storyboard in Resources */,
232 | 4117DA6C1D8FBC1200A2C652 /* LaunchScreen.storyboard in Resources */,
233 | 4117DA691D8FBC1200A2C652 /* Assets.xcassets in Resources */,
234 | );
235 | runOnlyForDeploymentPostprocessing = 0;
236 | };
237 | /* End PBXResourcesBuildPhase section */
238 |
239 | /* Begin PBXSourcesBuildPhase section */
240 | 4117DA1C1D8FBA4F00A2C652 /* Sources */ = {
241 | isa = PBXSourcesBuildPhase;
242 | buildActionMask = 2147483647;
243 | files = (
244 | 4117DA2E1D8FBAD600A2C652 /* KYDigitalFontView.swift in Sources */,
245 | );
246 | runOnlyForDeploymentPostprocessing = 0;
247 | };
248 | 4117DA5B1D8FBC1200A2C652 /* Sources */ = {
249 | isa = PBXSourcesBuildPhase;
250 | buildActionMask = 2147483647;
251 | files = (
252 | 4117DA641D8FBC1200A2C652 /* ViewController.swift in Sources */,
253 | 4117DA621D8FBC1200A2C652 /* AppDelegate.swift in Sources */,
254 | );
255 | runOnlyForDeploymentPostprocessing = 0;
256 | };
257 | /* End PBXSourcesBuildPhase section */
258 |
259 | /* Begin PBXTargetDependency section */
260 | 4117DA741D8FBC8600A2C652 /* PBXTargetDependency */ = {
261 | isa = PBXTargetDependency;
262 | target = 4117DA201D8FBA4F00A2C652 /* KYDigitalFontView */;
263 | targetProxy = 4117DA731D8FBC8600A2C652 /* PBXContainerItemProxy */;
264 | };
265 | /* End PBXTargetDependency section */
266 |
267 | /* Begin PBXVariantGroup section */
268 | 4117DA6A1D8FBC1200A2C652 /* LaunchScreen.storyboard */ = {
269 | isa = PBXVariantGroup;
270 | children = (
271 | 4117DA6B1D8FBC1200A2C652 /* Base */,
272 | );
273 | name = LaunchScreen.storyboard;
274 | sourceTree = "";
275 | };
276 | /* End PBXVariantGroup section */
277 |
278 | /* Begin XCBuildConfiguration section */
279 | 4117DA271D8FBA4F00A2C652 /* Debug */ = {
280 | isa = XCBuildConfiguration;
281 | buildSettings = {
282 | ALWAYS_SEARCH_USER_PATHS = NO;
283 | CLANG_ANALYZER_NONNULL = YES;
284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
285 | CLANG_CXX_LIBRARY = "libc++";
286 | CLANG_ENABLE_MODULES = YES;
287 | CLANG_ENABLE_OBJC_ARC = YES;
288 | CLANG_WARN_BOOL_CONVERSION = YES;
289 | CLANG_WARN_CONSTANT_CONVERSION = YES;
290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
291 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
292 | CLANG_WARN_EMPTY_BODY = YES;
293 | CLANG_WARN_ENUM_CONVERSION = YES;
294 | CLANG_WARN_INFINITE_RECURSION = YES;
295 | CLANG_WARN_INT_CONVERSION = YES;
296 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
297 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
298 | CLANG_WARN_UNREACHABLE_CODE = YES;
299 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
300 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
301 | COPY_PHASE_STRIP = NO;
302 | CURRENT_PROJECT_VERSION = 1;
303 | DEBUG_INFORMATION_FORMAT = dwarf;
304 | ENABLE_STRICT_OBJC_MSGSEND = YES;
305 | ENABLE_TESTABILITY = YES;
306 | GCC_C_LANGUAGE_STANDARD = gnu99;
307 | GCC_DYNAMIC_NO_PIC = NO;
308 | GCC_NO_COMMON_BLOCKS = YES;
309 | GCC_OPTIMIZATION_LEVEL = 0;
310 | GCC_PREPROCESSOR_DEFINITIONS = (
311 | "DEBUG=1",
312 | "$(inherited)",
313 | );
314 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
315 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
316 | GCC_WARN_UNDECLARED_SELECTOR = YES;
317 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
318 | GCC_WARN_UNUSED_FUNCTION = YES;
319 | GCC_WARN_UNUSED_VARIABLE = YES;
320 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
321 | MTL_ENABLE_DEBUG_INFO = YES;
322 | ONLY_ACTIVE_ARCH = YES;
323 | SDKROOT = iphoneos;
324 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
325 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
326 | TARGETED_DEVICE_FAMILY = "1,2";
327 | VERSIONING_SYSTEM = "apple-generic";
328 | VERSION_INFO_PREFIX = "";
329 | };
330 | name = Debug;
331 | };
332 | 4117DA281D8FBA4F00A2C652 /* Release */ = {
333 | isa = XCBuildConfiguration;
334 | buildSettings = {
335 | ALWAYS_SEARCH_USER_PATHS = NO;
336 | CLANG_ANALYZER_NONNULL = YES;
337 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
338 | CLANG_CXX_LIBRARY = "libc++";
339 | CLANG_ENABLE_MODULES = YES;
340 | CLANG_ENABLE_OBJC_ARC = YES;
341 | CLANG_WARN_BOOL_CONVERSION = YES;
342 | CLANG_WARN_CONSTANT_CONVERSION = YES;
343 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
344 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
345 | CLANG_WARN_EMPTY_BODY = YES;
346 | CLANG_WARN_ENUM_CONVERSION = YES;
347 | CLANG_WARN_INFINITE_RECURSION = YES;
348 | CLANG_WARN_INT_CONVERSION = YES;
349 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
350 | CLANG_WARN_SUSPICIOUS_MOVES = YES;
351 | CLANG_WARN_UNREACHABLE_CODE = YES;
352 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
353 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
354 | COPY_PHASE_STRIP = NO;
355 | CURRENT_PROJECT_VERSION = 1;
356 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
357 | ENABLE_NS_ASSERTIONS = NO;
358 | ENABLE_STRICT_OBJC_MSGSEND = YES;
359 | GCC_C_LANGUAGE_STANDARD = gnu99;
360 | GCC_NO_COMMON_BLOCKS = YES;
361 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
362 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
363 | GCC_WARN_UNDECLARED_SELECTOR = YES;
364 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
365 | GCC_WARN_UNUSED_FUNCTION = YES;
366 | GCC_WARN_UNUSED_VARIABLE = YES;
367 | IPHONEOS_DEPLOYMENT_TARGET = 10.0;
368 | MTL_ENABLE_DEBUG_INFO = NO;
369 | SDKROOT = iphoneos;
370 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
371 | TARGETED_DEVICE_FAMILY = "1,2";
372 | VALIDATE_PRODUCT = YES;
373 | VERSIONING_SYSTEM = "apple-generic";
374 | VERSION_INFO_PREFIX = "";
375 | };
376 | name = Release;
377 | };
378 | 4117DA2A1D8FBA4F00A2C652 /* Debug */ = {
379 | isa = XCBuildConfiguration;
380 | buildSettings = {
381 | CLANG_ENABLE_MODULES = YES;
382 | CODE_SIGN_IDENTITY = "";
383 | DEFINES_MODULE = YES;
384 | DYLIB_COMPATIBILITY_VERSION = 1;
385 | DYLIB_CURRENT_VERSION = 1;
386 | DYLIB_INSTALL_NAME_BASE = "@rpath";
387 | INFOPLIST_FILE = KYDigitalFontView/Info.plist;
388 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
389 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
390 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
391 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyo--hei.KYDigitalFontView";
392 | PRODUCT_NAME = "$(TARGET_NAME)";
393 | SKIP_INSTALL = YES;
394 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
395 | SWIFT_VERSION = 3.0;
396 | };
397 | name = Debug;
398 | };
399 | 4117DA2B1D8FBA4F00A2C652 /* Release */ = {
400 | isa = XCBuildConfiguration;
401 | buildSettings = {
402 | CLANG_ENABLE_MODULES = YES;
403 | CODE_SIGN_IDENTITY = "";
404 | DEFINES_MODULE = YES;
405 | DYLIB_COMPATIBILITY_VERSION = 1;
406 | DYLIB_CURRENT_VERSION = 1;
407 | DYLIB_INSTALL_NAME_BASE = "@rpath";
408 | INFOPLIST_FILE = KYDigitalFontView/Info.plist;
409 | INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
410 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
411 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
412 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyo--hei.KYDigitalFontView";
413 | PRODUCT_NAME = "$(TARGET_NAME)";
414 | SKIP_INSTALL = YES;
415 | SWIFT_VERSION = 3.0;
416 | };
417 | name = Release;
418 | };
419 | 4117DA6F1D8FBC1200A2C652 /* Debug */ = {
420 | isa = XCBuildConfiguration;
421 | buildSettings = {
422 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
423 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
424 | INFOPLIST_FILE = Example/Info.plist;
425 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
426 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyo--hei.Example";
427 | PRODUCT_NAME = "$(TARGET_NAME)";
428 | SWIFT_VERSION = 3.0;
429 | };
430 | name = Debug;
431 | };
432 | 4117DA701D8FBC1200A2C652 /* Release */ = {
433 | isa = XCBuildConfiguration;
434 | buildSettings = {
435 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
436 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
437 | INFOPLIST_FILE = Example/Info.plist;
438 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
439 | PRODUCT_BUNDLE_IDENTIFIER = "com.kyo--hei.Example";
440 | PRODUCT_NAME = "$(TARGET_NAME)";
441 | SWIFT_VERSION = 3.0;
442 | };
443 | name = Release;
444 | };
445 | /* End XCBuildConfiguration section */
446 |
447 | /* Begin XCConfigurationList section */
448 | 4117DA1B1D8FBA4F00A2C652 /* Build configuration list for PBXProject "KYDigitalFontView" */ = {
449 | isa = XCConfigurationList;
450 | buildConfigurations = (
451 | 4117DA271D8FBA4F00A2C652 /* Debug */,
452 | 4117DA281D8FBA4F00A2C652 /* Release */,
453 | );
454 | defaultConfigurationIsVisible = 0;
455 | defaultConfigurationName = Release;
456 | };
457 | 4117DA291D8FBA4F00A2C652 /* Build configuration list for PBXNativeTarget "KYDigitalFontView" */ = {
458 | isa = XCConfigurationList;
459 | buildConfigurations = (
460 | 4117DA2A1D8FBA4F00A2C652 /* Debug */,
461 | 4117DA2B1D8FBA4F00A2C652 /* Release */,
462 | );
463 | defaultConfigurationIsVisible = 0;
464 | defaultConfigurationName = Release;
465 | };
466 | 4117DA6E1D8FBC1200A2C652 /* Build configuration list for PBXNativeTarget "Example" */ = {
467 | isa = XCConfigurationList;
468 | buildConfigurations = (
469 | 4117DA6F1D8FBC1200A2C652 /* Debug */,
470 | 4117DA701D8FBC1200A2C652 /* Release */,
471 | );
472 | defaultConfigurationIsVisible = 0;
473 | };
474 | /* End XCConfigurationList section */
475 | };
476 | rootObject = 4117DA181D8FBA4F00A2C652 /* Project object */;
477 | }
478 |
--------------------------------------------------------------------------------
/Example/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
--------------------------------------------------------------------------------
/KYDigitalFontView/Classes/KYDigitalFontView.swift:
--------------------------------------------------------------------------------
1 | /*
2 | The MIT License (MIT)
3 |
4 | Copyright (c) 2015 Kyohei Yamaguchi
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
23 | */
24 |
25 | import UIKit
26 |
27 | @IBDesignable
28 | open class KYDigitalFontView: UIView {
29 |
30 | public struct DrawPositions : OptionSet {
31 |
32 | public let rawValue: UInt
33 |
34 | public init(rawValue: UInt) {
35 | self.rawValue = rawValue
36 | }
37 |
38 | public init(character: Character) {
39 | switch character {
40 | case "a", "A": self = [._0,._1,._2,._6,._7,._8,._9,._13]
41 | case "b", "B": self = [._0,._1,._4,._6,._7,._8,._11,._13,._14,._15]
42 | case "c", "C": self = [._0,._1,._2,._9,._14,._15]
43 | case "d", "D": self = [._0,._1,._4,._6,._11,._13,._14,._15]
44 | case "e", "E": self = [._0,._1,._2,._7,._8,._9,._14,._15]
45 | case "f", "F": self = [._0,._1,._2,._7,._8,._9]
46 | case "g", "G": self = [._0,._1,._2,._8,._9,._13,._14,._15]
47 | case "h", "H": self = [._2,._6,._7,._8,._9,._13]
48 | case "i", "I": self = [._0,._1,._4,._11,._14,._15]
49 | case "j", "J": self = [._6,._9,._13,._14,._15]
50 | case "k", "K": self = [._2,._5,._7,._9,._12]
51 | case "l", "L": self = [._2,._9,._14,._15]
52 | case "m", "M": self = [._2,._3,._5,._6,._9,._13]
53 | case "n", "N": self = [._2,._3,._6,._9,._12,._13]
54 | case "o", "O": self = [._0,._1,._2,._6,._9,._13,._14,._15]
55 | case "p", "P": self = [._0,._1,._2,._6,._7,._8,._9]
56 | case "q", "Q": self = [._0,._1,._2,._6,._9,._12,._13,._14,._15]
57 | case "r", "R": self = [._0,._1,._2,._6,._7,._8,._9,._12]
58 | case "s", "S", "5": self = [._0,._1,._2,._7,._8,._13,._14,._15]
59 | case "t", "T": self = [._0,._1,._4,._11]
60 | case "u", "U": self = [._2,._6,._9,._13,._14,._15]
61 | case "v", "V": self = [._2,._5,._9,._10]
62 | case "w", "W": self = [._2,._6,._9,._11,._13,._14,._15]
63 | case "x", "X": self = [._3,._5,._10,._12]
64 | case "y", "Y": self = [._3,._5,._11]
65 | case "z", "Z": self = [._0,._1,._5,._10,._14,._15]
66 | case "0": self = [._0,._1,._2,._3,._6,._9,._12,._13,._14,._15]
67 | case "1", "!": self = [._4,._11]
68 | case "2": self = [._0,._1,._6,._7,._8,._9,._14,._15]
69 | case "3": self = [._0,._1,._6,._7,._8,._13,._14,._15]
70 | case "4": self = [._2,._6,._7,._8,._13]
71 | case "6": self = [._0,._1,._2,._7,._8,._9,._13,._14,._15]
72 | case "7": self = [._0,._1,._6,._13]
73 | case "8": self = [._0,._1,._2,._6,._7,._8,._9,._13,._14,._15]
74 | case "9": self = [._0,._1,._2,._6,._7,._8,._13,._14,._15]
75 | case "$", "$": self = [._0,._1,._2,._4,._7,._8,._11,._13,._14,._15]
76 | case "+", "+": self = [._4,._7,._8,._11]
77 | case "-", "ー": self = [._7,._8]
78 | case "*", "*": self = [._3,._4,._5,._7,._8,._10,._11,._12]
79 | case "/", "/": self = [._5,._10]
80 | case "=", "=": self = [._7,._8,._14,._15]
81 | case "%", "%": self = [._0,._2,._4,._5,._7,._8,._10,._11,._13,._15]
82 | case "\"", "”": self = [._4,._6]
83 | case "\'", "’": self = [._4]
84 | case "#", "#": self = [._2,._4,._7,._8,._9,._11,._14,._15]
85 | case "@", "@": self = [._0,._1,._2,._6,._8,._9,._11,._13,._15]
86 | case "&", "&": self = [._0,._3,._4,._7,._9,._12,._13,._14,._15]
87 | case "_", "_": self = [._14,._15]
88 | case "[", "(", "[", "(": self = [._1,._4,._11,._15]
89 | case "]", ")", "]", ")": self = [._0,._4,._11,._14]
90 | case "?", "?": self = [._0,._1,._6,._8,._11]
91 | case "\\", "\": self = [._3,._12]
92 | case "{", "{": self = [._1,._4,._7,._11,._15]
93 | case "}", "}": self = [._0,._4,._8,._11,._14]
94 | case "<", "<": self = [._5,._12]
95 | case ">", ">": self = [._3,._10]
96 | case "`", "`": self = [._3]
97 | case "^", "^": self = [._10,._12]
98 | case "~", "〜": self = [._9,._7,._11,._15]
99 | default: self = .All
100 | }
101 | }
102 |
103 | public static var None: DrawPositions { return self.init(rawValue: 0b0000000000000000) }
104 | public static var _0 : DrawPositions { return self.init(rawValue: 0b0000000000000001) }
105 | public static var _1 : DrawPositions { return self.init(rawValue: 0b0000000000000010) }
106 | public static var _2 : DrawPositions { return self.init(rawValue: 0b0000000000000100) }
107 | public static var _3 : DrawPositions { return self.init(rawValue: 0b0000000000001000) }
108 | public static var _4 : DrawPositions { return self.init(rawValue: 0b0000000000010000) }
109 | public static var _5 : DrawPositions { return self.init(rawValue: 0b0000000000100000) }
110 | public static var _6 : DrawPositions { return self.init(rawValue: 0b0000000001000000) }
111 | public static var _7 : DrawPositions { return self.init(rawValue: 0b0000000010000000) }
112 | public static var _8 : DrawPositions { return self.init(rawValue: 0b0000000100000000) }
113 | public static var _9 : DrawPositions { return self.init(rawValue: 0b0000001000000000) }
114 | public static var _10 : DrawPositions { return self.init(rawValue: 0b0000010000000000) }
115 | public static var _11 : DrawPositions { return self.init(rawValue: 0b0000100000000000) }
116 | public static var _12 : DrawPositions { return self.init(rawValue: 0b0001000000000000) }
117 | public static var _13 : DrawPositions { return self.init(rawValue: 0b0010000000000000) }
118 | public static var _14 : DrawPositions { return self.init(rawValue: 0b0100000000000000) }
119 | public static var _15 : DrawPositions { return self.init(rawValue: 0b1000000000000000) }
120 | public static var All : DrawPositions { return self.init(rawValue: 0b1111111111111111) }
121 |
122 | }
123 |
124 | @IBInspectable public var lineWidth: CGFloat = 20.0 {
125 | didSet {
126 | for (idx, layer) in _layers.enumerated() {
127 | let newPath = _paths[idx]
128 | layer.path = newPath.cgPath
129 | }
130 | }
131 | }
132 |
133 | @IBInspectable public var borderWidth: CGFloat = 0 {
134 | didSet {
135 | for layer in _layers {
136 | layer.lineWidth = borderWidth
137 | }
138 | }
139 | }
140 |
141 | @IBInspectable public var borderColor: UIColor = UIColor.clear {
142 | didSet {
143 | for layer in _layers {
144 | layer.strokeColor = borderColor.cgColor
145 | }
146 | }
147 | }
148 |
149 | @IBInspectable public var fillColor: UIColor = UIColor.black {
150 | didSet {
151 | for layer in _layers {
152 | layer.fillColor = fillColor.cgColor
153 | }
154 | }
155 | }
156 |
157 | @IBInspectable var character: String = " " {
158 | didSet {
159 | drawPositions = DrawPositions(character: character.characters.first!)
160 | }
161 | }
162 |
163 | public var drawPositions: DrawPositions = DrawPositions(character:"a") {
164 | didSet {
165 | setNeedsLayout()
166 | }
167 | }
168 |
169 | lazy private var _layer0 : CAShapeLayer = self.p_layerWithPath(self._path0)
170 | lazy private var _layer1 : CAShapeLayer = self.p_layerWithPath(self._path1)
171 | lazy private var _layer2 : CAShapeLayer = self.p_layerWithPath(self._path2)
172 | lazy private var _layer3 : CAShapeLayer = self.p_layerWithPath(self._path3)
173 | lazy private var _layer4 : CAShapeLayer = self.p_layerWithPath(self._path4)
174 | lazy private var _layer5 : CAShapeLayer = self.p_layerWithPath(self._path5)
175 | lazy private var _layer6 : CAShapeLayer = self.p_layerWithPath(self._path6)
176 | lazy private var _layer7 : CAShapeLayer = self.p_layerWithPath(self._path7)
177 | lazy private var _layer8 : CAShapeLayer = self.p_layerWithPath(self._path8)
178 | lazy private var _layer9 : CAShapeLayer = self.p_layerWithPath(self._path9)
179 | lazy private var _layer10: CAShapeLayer = self.p_layerWithPath(self._path10)
180 | lazy private var _layer11: CAShapeLayer = self.p_layerWithPath(self._path11)
181 | lazy private var _layer12: CAShapeLayer = self.p_layerWithPath(self._path12)
182 | lazy private var _layer13: CAShapeLayer = self.p_layerWithPath(self._path13)
183 | lazy private var _layer14: CAShapeLayer = self.p_layerWithPath(self._path14)
184 | lazy private var _layer15: CAShapeLayer = self.p_layerWithPath(self._path15)
185 |
186 | private var _path0: UIBezierPath {
187 | let minX = self.lineWidth*0.875
188 | let maxX = self.bounds.width/2 - self.lineWidth*0.125
189 | let minY = self.lineWidth*0.25
190 | let midY = self.lineWidth*0.75
191 | let maxY = self.lineWidth*1.25
192 | return p_horizontalPathWitnMinX(minX, maxX: maxX, minY: minY, midY: midY, maxY: maxY)
193 | }
194 |
195 | private var _path1: UIBezierPath {
196 | let minX = self.bounds.width/2 + self.lineWidth*0.125
197 | let maxX = self.bounds.width - self.lineWidth*0.875
198 | let minY = self.lineWidth*0.25
199 | let midY = self.lineWidth*0.75
200 | let maxY = self.lineWidth*1.25
201 | return p_horizontalPathWitnMinX(minX, maxX: maxX, minY: minY, midY: midY, maxY: maxY)
202 | }
203 |
204 | private var _path2: UIBezierPath {
205 | let minX = self.lineWidth*0.25
206 | let midX = self.lineWidth*0.75
207 | let maxX = self.lineWidth*1.25
208 | let minY = self.lineWidth
209 | let maxY = self.bounds.height/2 - self.lineWidth*0.25
210 | return self.p_verticalPathWitnMinX(minX, midX: midX, maxX: maxX, minY: minY, maxY: maxY)
211 | }
212 |
213 | private var _path3: UIBezierPath {
214 | let minX = self.lineWidth*1.5
215 | let maxX = self.bounds.width/2 - self.lineWidth*0.75
216 | let minY = self.lineWidth*1.5
217 | let maxY = self.bounds.height/2 - self.lineWidth*0.75
218 | return self.p_backSlashPathWitnMinX(minX, maxX: maxX, minY: minY, maxY: maxY)
219 | }
220 |
221 | private var _path4: UIBezierPath {
222 | let minX = self.bounds.width/2 - self.lineWidth*0.5
223 | let midX = self.bounds.width/2
224 | let maxX = self.bounds.width/2 + self.lineWidth*0.5
225 | let minY = self.lineWidth
226 | let maxY = self.bounds.height/2 - self.lineWidth*0.25
227 | return self.p_verticalPathWitnMinX(minX, midX: midX, maxX: maxX, minY: minY, maxY: maxY)
228 | }
229 |
230 | private var _path5: UIBezierPath {
231 | let minX = self.bounds.width/2 + self.lineWidth*0.75
232 | let maxX = self.bounds.width - self.lineWidth*1.5
233 | let minY = self.lineWidth*1.5
234 | let maxY = self.bounds.height/2 - self.lineWidth*0.75
235 | return self.p_slashPathWitnMinX(minX, maxX: maxX, minY: minY, maxY: maxY)
236 | }
237 |
238 | private var _path6: UIBezierPath {
239 | let minX = self.bounds.width - self.lineWidth*1.25
240 | let midX = self.bounds.width - self.lineWidth*0.75
241 | let maxX = self.bounds.width - self.lineWidth*0.25
242 | let minY = self.lineWidth
243 | let maxY = self.bounds.height/2 - self.lineWidth*0.25
244 | return self.p_verticalPathWitnMinX(minX, midX: midX, maxX: maxX, minY: minY, maxY: maxY)
245 | }
246 |
247 | private var _path7: UIBezierPath {
248 | let minX = self.lineWidth*0.875
249 | let maxX = self.bounds.width/2 - self.lineWidth*0.125
250 | let minY = self.bounds.height/2 - self.lineWidth*0.5
251 | let midY = self.bounds.height/2
252 | let maxY = self.bounds.height/2 + self.lineWidth*0.5
253 | return self.p_horizontalPathWitnMinX(minX, maxX: maxX, minY: minY, midY: midY, maxY: maxY)
254 | }
255 |
256 | private var _path8: UIBezierPath {
257 | let minX = self.bounds.width/2 + self.lineWidth*0.125
258 | let maxX = self.bounds.width - self.lineWidth*0.875
259 | let minY = self.bounds.height/2 - self.lineWidth*0.5
260 | let midY = self.bounds.height/2
261 | let maxY = self.bounds.height/2 + self.lineWidth*0.5
262 | return self.p_horizontalPathWitnMinX(minX, maxX: maxX, minY: minY, midY: midY, maxY: maxY)
263 | }
264 |
265 | private var _path9: UIBezierPath {
266 | let minX = self.lineWidth*0.25
267 | let midX = self.lineWidth*0.75
268 | let maxX = self.lineWidth*1.25
269 | let minY = self.bounds.height/2 + self.lineWidth*0.25
270 | let maxY = self.bounds.height - self.lineWidth
271 | return self.p_verticalPathWitnMinX(minX, midX: midX, maxX: maxX, minY: minY, maxY: maxY)
272 | }
273 |
274 | private var _path10: UIBezierPath {
275 | let minX = self.lineWidth*1.5
276 | let maxX = self.bounds.width/2 - self.lineWidth*0.75
277 | let minY = self.bounds.height/2 + self.lineWidth*0.75
278 | let maxY = self.bounds.height - self.lineWidth*1.5
279 | return self.p_slashPathWitnMinX(minX, maxX: maxX, minY: minY, maxY: maxY)
280 | }
281 |
282 | private var _path11: UIBezierPath {
283 | let minX = self.bounds.width/2 - self.lineWidth*0.5
284 | let midX = self.bounds.width/2
285 | let maxX = self.bounds.width/2 + self.lineWidth*0.5
286 | let minY = self.bounds.height/2 + self.lineWidth*0.25
287 | let maxY = self.bounds.height - self.lineWidth
288 | return self.p_verticalPathWitnMinX(minX, midX: midX, maxX: maxX, minY: minY, maxY: maxY)
289 | }
290 |
291 | private var _path12: UIBezierPath {
292 | let minX = self.bounds.width/2 + self.lineWidth*0.75
293 | let maxX = self.bounds.width - self.lineWidth*1.5
294 | let minY = self.bounds.height/2 + self.lineWidth*0.75
295 | let maxY = self.bounds.height - self.lineWidth*1.5
296 | return self.p_backSlashPathWitnMinX(minX, maxX: maxX, minY: minY, maxY: maxY)
297 | }
298 |
299 | private var _path13: UIBezierPath {
300 | let minX = self.bounds.width - self.lineWidth*1.25
301 | let midX = self.bounds.width - self.lineWidth*0.75
302 | let maxX = self.bounds.width - self.lineWidth*0.25
303 | let minY = self.bounds.height/2 + self.lineWidth*0.25
304 | let maxY = self.bounds.height - self.lineWidth
305 | return self.p_verticalPathWitnMinX(minX, midX: midX, maxX: maxX, minY: minY, maxY: maxY)
306 | }
307 |
308 | private var _path14: UIBezierPath {
309 | let minX = self.lineWidth*0.875
310 | let maxX = self.bounds.width/2 - self.lineWidth*0.125
311 | let minY = self.bounds.height - self.lineWidth*1.25
312 | let midY = self.bounds.height - self.lineWidth*0.75
313 | let maxY = self.bounds.height - self.lineWidth*0.25
314 | return self.p_horizontalPathWitnMinX(minX, maxX: maxX, minY: minY, midY: midY, maxY: maxY)
315 | }
316 |
317 | private var _path15: UIBezierPath {
318 | let minX = self.bounds.width/2 + self.lineWidth*0.125
319 | let maxX = self.bounds.width - self.lineWidth*0.875
320 | let minY = self.bounds.height - self.lineWidth*1.25
321 | let midY = self.bounds.height - self.lineWidth*0.75
322 | let maxY = self.bounds.height - self.lineWidth*0.25
323 | return self.p_horizontalPathWitnMinX(minX, maxX: maxX, minY: minY, midY: midY, maxY: maxY)
324 | }
325 |
326 | private var _visibleLayers: [CAShapeLayer] {
327 | var layers = [CAShapeLayer]()
328 | if drawPositions.contains([._0]) {
329 | layers.append(_layer0)
330 | }
331 | if drawPositions.contains([._1]) {
332 | layers.append(_layer1)
333 | }
334 | if drawPositions.contains([._2]) {
335 | layers.append(_layer2)
336 | }
337 | if drawPositions.contains([._3]) {
338 | layers.append(_layer3)
339 | }
340 | if drawPositions.contains([._4]) {
341 | layers.append(_layer4)
342 | }
343 | if drawPositions.contains([._5]) {
344 | layers.append(_layer5)
345 | }
346 | if drawPositions.contains([._6]) {
347 | layers.append(_layer6)
348 | }
349 | if drawPositions.contains([._7]) {
350 | layers.append(_layer7)
351 | }
352 | if drawPositions.contains([._8]) {
353 | layers.append(_layer8)
354 | }
355 | if drawPositions.contains([._9]) {
356 | layers.append(_layer9)
357 | }
358 | if drawPositions.contains([._10]) {
359 | layers.append(_layer10)
360 | }
361 | if drawPositions.contains([._11]) {
362 | layers.append(_layer11)
363 | }
364 | if drawPositions.contains([._12]) {
365 | layers.append(_layer12)
366 | }
367 | if drawPositions.contains([._13]) {
368 | layers.append(_layer13)
369 | }
370 | if drawPositions.contains([._14]) {
371 | layers.append(_layer14)
372 | }
373 | if drawPositions.contains([._15]) {
374 | layers.append(_layer15)
375 | }
376 | return layers
377 | }
378 |
379 | private var _layers: [CAShapeLayer] {
380 | return [
381 | _layer0,
382 | _layer1,
383 | _layer2,
384 | _layer3,
385 | _layer4,
386 | _layer5,
387 | _layer6,
388 | _layer7,
389 | _layer8,
390 | _layer9,
391 | _layer10,
392 | _layer11,
393 | _layer12,
394 | _layer13,
395 | _layer14,
396 | _layer15
397 | ]
398 | }
399 |
400 | private var _paths: [UIBezierPath] {
401 | return [
402 | _path0,
403 | _path1,
404 | _path2,
405 | _path3,
406 | _path4,
407 | _path5,
408 | _path6,
409 | _path7,
410 | _path8,
411 | _path9,
412 | _path10,
413 | _path11,
414 | _path12,
415 | _path13,
416 | _path14,
417 | _path15
418 | ]
419 |
420 | }
421 |
422 | open override func layoutSubviews() {
423 | super.layoutSubviews()
424 | for (idx, subLayer) in _layers.enumerated() {
425 | subLayer.isHidden = true
426 | if subLayer.superlayer == nil {
427 | layer.addSublayer(subLayer)
428 | } else {
429 | let newPath = _paths[idx]
430 | subLayer.path = newPath.cgPath
431 | }
432 | }
433 | for visibleLayer in _visibleLayers {
434 | visibleLayer.isHidden = false
435 | }
436 | }
437 |
438 | /**************************************************************************/
439 | // MARK: - Method
440 | /**************************************************************************/
441 |
442 | private func p_horizontalPathWitnMinX(_ minX: CGFloat, maxX: CGFloat, minY: CGFloat, midY: CGFloat, maxY: CGFloat) -> UIBezierPath {
443 | let path = UIBezierPath()
444 | path.move(to: CGPoint(x: minX, y: midY))
445 | path.addLine(to: CGPoint(x: minX + self.lineWidth*0.5, y: minY))
446 | path.addLine(to: CGPoint(x: maxX - self.lineWidth*0.5, y: minY))
447 | path.addLine(to: CGPoint(x: maxX, y: midY))
448 | path.addLine(to: CGPoint(x: maxX - self.lineWidth*0.5, y: maxY))
449 | path.addLine(to: CGPoint(x: minX + self.lineWidth*0.5, y: maxY))
450 | path.addLine(to: CGPoint(x: minX, y: midY))
451 | path.close()
452 | return path
453 | }
454 |
455 | private func p_verticalPathWitnMinX(_ minX: CGFloat, midX: CGFloat, maxX: CGFloat, minY: CGFloat, maxY: CGFloat) -> UIBezierPath {
456 | let path = UIBezierPath()
457 | path.move(to: CGPoint(x: midX, y: minY))
458 | path.addLine(to: CGPoint(x: maxX, y: minY + self.lineWidth*0.5))
459 | path.addLine(to: CGPoint(x: maxX, y: maxY - self.lineWidth*0.5))
460 | path.addLine(to: CGPoint(x: midX, y: maxY))
461 | path.addLine(to: CGPoint(x: minX, y: maxY - self.lineWidth*0.5))
462 | path.addLine(to: CGPoint(x: minX, y: minY + self.lineWidth*0.5))
463 | path.addLine(to: CGPoint(x: midX, y: minY))
464 | path.close()
465 | return path
466 | }
467 |
468 | private func p_backSlashPathWitnMinX(_ minX: CGFloat, maxX: CGFloat, minY: CGFloat, maxY: CGFloat) -> UIBezierPath {
469 | let path = UIBezierPath()
470 | path.move(to: CGPoint(x: minX, y: minY))
471 | path.addLine(to: CGPoint(x: minX + self.lineWidth*0.75, y: minY))
472 | path.addLine(to: CGPoint(x: maxX, y: maxY - self.lineWidth*0.75))
473 | path.addLine(to: CGPoint(x: maxX, y: maxY))
474 | path.addLine(to: CGPoint(x: maxX - self.lineWidth*0.75, y: maxY))
475 | path.addLine(to: CGPoint(x: minX, y: minY + self.lineWidth*0.75))
476 | path.addLine(to: CGPoint(x: minX, y: minY))
477 | path.close()
478 | return path
479 | }
480 |
481 | private func p_slashPathWitnMinX(_ minX: CGFloat, maxX: CGFloat, minY: CGFloat, maxY: CGFloat) -> UIBezierPath {
482 | let path = UIBezierPath()
483 | path.move(to: CGPoint(x: minX, y: maxY))
484 | path.addLine(to: CGPoint(x: minX, y: maxY - self.lineWidth*0.75))
485 | path.addLine(to: CGPoint(x: maxX - self.lineWidth*0.75, y: minY))
486 | path.addLine(to: CGPoint(x: maxX, y: minY))
487 | path.addLine(to: CGPoint(x: maxX, y: minY + self.lineWidth*0.75))
488 | path.addLine(to: CGPoint(x: minX + self.lineWidth*0.75, y: maxY))
489 | path.addLine(to: CGPoint(x: minX, y: maxY))
490 | path.close()
491 | return path
492 | }
493 |
494 | private func p_layerWithPath(_ path: UIBezierPath) -> CAShapeLayer {
495 | let layer = CAShapeLayer()
496 | layer.path = path.cgPath
497 | layer.strokeColor = borderColor.cgColor
498 | layer.lineWidth = borderWidth
499 | layer.fillColor = fillColor.cgColor
500 | layer.frame = self.bounds
501 | return layer
502 | }
503 | }
504 |
--------------------------------------------------------------------------------