├── .gitignore
├── CODE_OF_CONDUCT.md
├── LICENSE
├── README.md
├── Screenshots
├── fonts.png
├── icons.png
├── screenshot-dark.png
└── screenshot.png
├── Semantic Colors.xcodeproj
├── project.pbxproj
└── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ ├── IDEWorkspaceChecks.plist
│ └── swiftpm
│ └── Package.resolved
└── Semantic Colors
├── AppDelegate.swift
├── Assets.xcassets
├── AppIcon.appiconset
│ ├── Contents.json
│ ├── icon_20pt.png
│ ├── icon_20pt@2x-1.png
│ ├── icon_20pt@2x.png
│ ├── icon_20pt@3x.png
│ ├── icon_29pt-1.png
│ ├── icon_29pt.png
│ ├── icon_29pt@2x-1.png
│ ├── icon_29pt@2x.png
│ ├── icon_29pt@3x.png
│ ├── icon_40pt.png
│ ├── icon_40pt@2x-1.png
│ ├── icon_40pt@2x.png
│ ├── icon_40pt@3x.png
│ ├── icon_60pt@2x.png
│ ├── icon_60pt@3x.png
│ ├── icon_76pt.png
│ ├── icon_76pt@2x.png
│ ├── icon_83.5@2x.png
│ └── icon_App store.png
└── Contents.json
├── Base.lproj
└── LaunchScreen.storyboard
├── ColorStackViewController.swift
├── ColorsViewController.swift
├── DemosController.swift
├── FontWeightViewController.swift
├── FontsDesignViewController.swift
├── FontsViewController.swift
├── Helpers.swift
├── IconsViewController.swift
├── Info.plist
└── SwiftUIColorsView.swift
/.gitignore:
--------------------------------------------------------------------------------
1 | # Xcode
2 | #
3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4 |
5 | ## Build generated
6 | build/
7 | DerivedData/
8 |
9 | ## Various settings
10 | *.pbxuser
11 | !default.pbxuser
12 | *.mode1v3
13 | !default.mode1v3
14 | *.mode2v3
15 | !default.mode2v3
16 | *.perspectivev3
17 | !default.perspectivev3
18 | xcuserdata/
19 |
20 | ## Other
21 | *.moved-aside
22 | *.xccheckout
23 | *.xcscmblueprint
24 |
25 | ## Obj-C/Swift specific
26 | *.hmap
27 | *.ipa
28 | *.dSYM.zip
29 | *.dSYM
30 |
31 | ## Playgrounds
32 | timeline.xctimeline
33 | playground.xcworkspace
34 |
35 | # Swift Package Manager
36 | #
37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
38 | # Packages/
39 | # Package.pins
40 | # Package.resolved
41 | .build/
42 |
43 | # CocoaPods
44 | #
45 | # We recommend against adding the Pods directory to your .gitignore. However
46 | # you should judge for yourself, the pros and cons are mentioned at:
47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
48 | #
49 | # Pods/
50 |
51 | # Carthage
52 | #
53 | # Add this line if you want to avoid checking in source code from Carthage dependencies.
54 | # Carthage/Checkouts
55 |
56 | Carthage/Build
57 |
58 | # fastlane
59 | #
60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
61 | # screenshots whenever they are needed.
62 | # For more information about the recommended setup visit:
63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control
64 |
65 | fastlane/report.xml
66 | fastlane/Preview.html
67 | fastlane/screenshots/**/*.png
68 | fastlane/test_output
69 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, sex characteristics, gender identity and expression,
9 | level of experience, education, socio-economic status, nationality, personal
10 | appearance, race, religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at aaron@brethorsting.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
75 | For answers to common questions about this code of conduct, see
76 | https://www.contributor-covenant.org/faq
77 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Aaron Brethorst
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 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # iOS Semantic UI: Dark Mode, Dynamic Type, and SF Symbols
2 |
3 | This sample project makes it easy to visualize all of iOS's semantic and adaptable colors, preferred fonts for text styles, and built-in icons.
4 |
5 | Semantic colors automatically adapt to system settings, like Dark Mode, to give your app a UI that is always legible.
6 |
7 | Semantic fonts are used in Dynamic Type to make sure that your font sizes always scale with to meet the user's needs.
8 |
9 | SF Symbols is an icon font that gives you and your apps access to over 1,000 Apple designer-created icons.
10 |
11 | ## Light Mode
12 |
13 |
14 |
15 | ## Dark Mode
16 |
17 |
18 |
19 | ## Fonts
20 |
21 |
22 |
23 | ## SF Symbols
24 |
25 |
26 |
27 | # Colors
28 |
29 | ## Adaptable Colors
30 |
31 | Some colors are used by system elements and applications. These return named colors whose values may vary between different contexts and releases. Do not make assumptions about the color spaces or actual colors used.
32 |
33 | * `.systemRed`
34 | * `.systemGreen`
35 | * `.systemBlue`
36 | * `.systemIndigo`
37 | * `.systemOrange`
38 | * `.systemPink`
39 | * `.systemPurple`
40 | * `.systemTeal`
41 | * `.systemYellow`
42 |
43 | ## Adaptable Grays
44 |
45 | Shades of gray. `systemGray` is the base gray color. The numbered variations, `systemGray2` through `systemGray6`, are grays which increasingly trend away from `systemGray` and in the direction of `systemBackgroundColor`.
46 |
47 | In `UIUserInterfaceStyleLight`: `systemGray1` is slightly lighter than `systemGray`. `systemGray2` is lighter than that, and so on.
48 |
49 | In `UIUserInterfaceStyleDark`: `systemGray1` is slightly darker than `systemGray`. `systemGray2` is darker than that, and so on.
50 |
51 | * `.systemGray`
52 | * `.systemGray2`
53 | * `.systemGray3`
54 | * `.systemGray4`
55 | * `.systemGray5`
56 | * `.systemGray6`
57 |
58 | ## Label Colors
59 |
60 | Foreground colors for static text and related elements.
61 |
62 | * `.label`
63 | * `.secondaryLabel`
64 | * `.tertiaryLabel`
65 | * `.quaternaryLabel`
66 |
67 | ## Text Colors
68 |
69 | Foreground color for placeholder text in controls or text fields or text views.
70 |
71 | * `.placeholderText`
72 |
73 | ## Link Color
74 |
75 | Foreground color for standard system links.
76 |
77 | * `.link`
78 |
79 | ## Separators
80 |
81 | Foreground colors for separators (thin border or divider lines). `separatorColor` may be partially transparent, so it can go on top of any content. `opaqueSeparatorColor` is intended to look similar, but is guaranteed to be opaque, so it will completely cover anything behind it. Depending on the situation, you may need one or the other.
82 |
83 | * `.separator`
84 | * `.opaqueSeparator`
85 |
86 | ## Fill Colors
87 |
88 | Fill colors for UI elements. These are meant to be used over the background colors, since their alpha component is less than 1.
89 |
90 | `systemFillColor` is appropriate for filling thin and small shapes. Example: The track of a slider.
91 |
92 | `secondarySystemFillColor` is appropriate for filling medium-size shapes. Example: The background of a switch.
93 |
94 | `tertiarySystemFillColor` is appropriate for filling large shapes. Examples: Input fields, search bars, buttons.
95 |
96 | `quaternarySystemFillColor` is appropriate for filling large areas containing complex content. Example: Expanded table cells.
97 |
98 | * `.systemFill`
99 | * `.secondarySystemFill`
100 | * `.tertiarySystemFill`
101 | * `.quaternarySystemFill`
102 |
103 | ## Background Colors
104 |
105 | We provide two design systems (also known as "stacks") for structuring an iOS app's backgrounds. Each stack has three "levels" of background colors. The first color is intended to be the main background, farthest back. Secondary and tertiary colors are layered on top of the main background, when appropriate.
106 |
107 | Inside of a discrete piece of UI, choose a stack, then use colors from that stack. We do not recommend mixing and matching background colors between stacks. The foreground colors above are designed to work in both stacks.
108 |
109 | Stack 1: `systemBackground` - Use this stack for views with standard table views, and designs which have a white primary background in light mode.
110 |
111 | * `.systemBackground`
112 | * `.secondarySystemBackground`
113 | * `.tertiarySystemBackground`
114 |
115 | ## Grouped Background Colors
116 |
117 | Stack 2: `systemGroupedBackground` - Use this stack for views with grouped content, such as grouped tables and platter-based designs. These are like grouped table views, but you may use these colors in places where a table view wouldn't make sense.
118 |
119 | * `.systemGroupedBackground`
120 | * `.secondarySystemGroupedBackground`
121 | * `.tertiarySystemGroupedBackground`
122 |
123 | ## Non-Adaptable Colors
124 |
125 | `lightTextColor` is always light, and `darkTextColor` is always dark, regardless of the current `UIUserInterfaceStyle`. When possible, we recommend using `labelColor` and its variants, instead.
126 |
127 | * `.lightText`
128 | * `.darkText`
129 |
130 | # Fonts
131 |
132 | Font text styles, semantic descriptions of the intended use for a font returned by `UIFont.preferredFont(forTextStyle:)`.
133 |
134 | * `.largeTitle`
135 | * `.title1`
136 | * `.title2`
137 | * `.title3`
138 | * `.headline`
139 | * `.subheadline`
140 | * `.body`
141 | * `.callout`
142 | * `.footnote`
143 | * `.caption1`
144 | * `.caption2`
145 |
146 | # Icons (SF Symbols)
147 |
148 | [SF Symbols](https://developer.apple.com/design/human-interface-guidelines/sf-symbols/overview/) provides a set of thousands of consistent, highly configurable symbols you can use in your app. Apple designed SF Symbols to integrate seamlessly with the San Francisco system font, so the symbols automatically ensure optical vertical alignment with text for all weights and sizes.
149 |
150 | # Contributors
151 |
152 | * [Aaron Brethorst](https://github.com/aaronbrethorst)
153 | * [Nicolas Garcia](https://github.com/nicoonguitar)
154 | * [Dan Turner](https://github.com/djtech42)
155 | * [Duncan Horne](https://github.com/Zem0)
156 | * [Renz](https://github.com/rhenz)
157 | * [JinSeok Yang](https://github.com/DanielY1108)
158 |
159 | # Third Party Libraries
160 |
161 | ## SFSymbols Library
162 |
163 | https://github.com/Rspoon3/SFSymbols
164 |
165 | MIT License
166 |
167 | Copyright (c) 2021 Richard Witherspoon
168 |
169 | Permission is hereby granted, free of charge, to any person obtaining a copy
170 | of this software and associated documentation files (the "Software"), to deal
171 | in the Software without restriction, including without limitation the rights
172 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
173 | copies of the Software, and to permit persons to whom the Software is
174 | furnished to do so, subject to the following conditions:
175 |
176 | The above copyright notice and this permission notice shall be included in all
177 | copies or substantial portions of the Software.
178 |
179 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
180 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
181 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
182 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
183 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
184 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
185 | SOFTWARE.
186 |
187 | # License
188 |
189 | Color names, fonts, icons, and descriptive text (c) Apple Inc. All code in this repository is:
190 |
191 | MIT License
192 |
193 | Copyright (c) 2019 Aaron Brethorst
194 |
195 | Permission is hereby granted, free of charge, to any person obtaining a copy
196 | of this software and associated documentation files (the "Software"), to deal
197 | in the Software without restriction, including without limitation the rights
198 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
199 | copies of the Software, and to permit persons to whom the Software is
200 | furnished to do so, subject to the following conditions:
201 |
202 | The above copyright notice and this permission notice shall be included in all
203 | copies or substantial portions of the Software.
204 |
205 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
206 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
207 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
208 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
209 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
210 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
211 | SOFTWARE.
212 |
--------------------------------------------------------------------------------
/Screenshots/fonts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Screenshots/fonts.png
--------------------------------------------------------------------------------
/Screenshots/icons.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Screenshots/icons.png
--------------------------------------------------------------------------------
/Screenshots/screenshot-dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Screenshots/screenshot-dark.png
--------------------------------------------------------------------------------
/Screenshots/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Screenshots/screenshot.png
--------------------------------------------------------------------------------
/Semantic Colors.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 54;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 5B8E794D2BA971B10015306E /* FontsDesignViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B8E794C2BA971B10015306E /* FontsDesignViewController.swift */; };
11 | 65634A442A4CA3DC005DDAD4 /* FontWeightViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 65634A432A4CA3DC005DDAD4 /* FontWeightViewController.swift */; };
12 | 9368BC4B23761210002A14FE /* IconsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9368BC4A23761210002A14FE /* IconsViewController.swift */; };
13 | 9368F026233966C70041AF64 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9368F025233966C70041AF64 /* AppDelegate.swift */; };
14 | 9368F02F233966CB0041AF64 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9368F02E233966CB0041AF64 /* Assets.xcassets */; };
15 | 9368F032233966CB0041AF64 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9368F030233966CB0041AF64 /* LaunchScreen.storyboard */; };
16 | 938C300D237743F000DFC6D8 /* ColorStackViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 938C300C237743F000DFC6D8 /* ColorStackViewController.swift */; };
17 | 93A34B3C2368B63500FE397D /* ColorsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A34B3B2368B63500FE397D /* ColorsViewController.swift */; };
18 | 93A34B3E2368B65F00FE397D /* FontsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93A34B3D2368B65F00FE397D /* FontsViewController.swift */; };
19 | 93FCD118237880F2005F3890 /* Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93FCD117237880F2005F3890 /* Helpers.swift */; };
20 | 93FCD11A2378C096005F3890 /* DemosController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93FCD1192378C096005F3890 /* DemosController.swift */; };
21 | E930F6902A4CBC790031460F /* SwiftUIColorsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E930F68F2A4CBC790031460F /* SwiftUIColorsView.swift */; };
22 | E930F6932A4CD36E0031460F /* SFSymbols in Frameworks */ = {isa = PBXBuildFile; productRef = E930F6922A4CD36E0031460F /* SFSymbols */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXFileReference section */
26 | 5B8E794C2BA971B10015306E /* FontsDesignViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FontsDesignViewController.swift; sourceTree = ""; };
27 | 65634A432A4CA3DC005DDAD4 /* FontWeightViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontWeightViewController.swift; sourceTree = ""; };
28 | 9368BC4A23761210002A14FE /* IconsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IconsViewController.swift; sourceTree = ""; };
29 | 9368F022233966C70041AF64 /* Semantic UI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Semantic UI.app"; sourceTree = BUILT_PRODUCTS_DIR; };
30 | 9368F025233966C70041AF64 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
31 | 9368F02E233966CB0041AF64 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
32 | 9368F031233966CB0041AF64 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
33 | 9368F033233966CB0041AF64 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
34 | 938C300C237743F000DFC6D8 /* ColorStackViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorStackViewController.swift; sourceTree = ""; };
35 | 93A34B3B2368B63500FE397D /* ColorsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ColorsViewController.swift; sourceTree = ""; };
36 | 93A34B3D2368B65F00FE397D /* FontsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FontsViewController.swift; sourceTree = ""; };
37 | 93FCD117237880F2005F3890 /* Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Helpers.swift; sourceTree = ""; };
38 | 93FCD1192378C096005F3890 /* DemosController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemosController.swift; sourceTree = ""; };
39 | E930F68F2A4CBC790031460F /* SwiftUIColorsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftUIColorsView.swift; sourceTree = ""; };
40 | /* End PBXFileReference section */
41 |
42 | /* Begin PBXFrameworksBuildPhase section */
43 | 9368F01F233966C70041AF64 /* Frameworks */ = {
44 | isa = PBXFrameworksBuildPhase;
45 | buildActionMask = 2147483647;
46 | files = (
47 | E930F6932A4CD36E0031460F /* SFSymbols in Frameworks */,
48 | );
49 | runOnlyForDeploymentPostprocessing = 0;
50 | };
51 | /* End PBXFrameworksBuildPhase section */
52 |
53 | /* Begin PBXGroup section */
54 | 9368F019233966C70041AF64 = {
55 | isa = PBXGroup;
56 | children = (
57 | 9368F024233966C70041AF64 /* Semantic Colors */,
58 | 9368F023233966C70041AF64 /* Products */,
59 | );
60 | sourceTree = "";
61 | };
62 | 9368F023233966C70041AF64 /* Products */ = {
63 | isa = PBXGroup;
64 | children = (
65 | 9368F022233966C70041AF64 /* Semantic UI.app */,
66 | );
67 | name = Products;
68 | sourceTree = "";
69 | };
70 | 9368F024233966C70041AF64 /* Semantic Colors */ = {
71 | isa = PBXGroup;
72 | children = (
73 | 93FCD1192378C096005F3890 /* DemosController.swift */,
74 | 9368BC4A23761210002A14FE /* IconsViewController.swift */,
75 | 93A34B3D2368B65F00FE397D /* FontsViewController.swift */,
76 | 65634A432A4CA3DC005DDAD4 /* FontWeightViewController.swift */,
77 | 5B8E794C2BA971B10015306E /* FontsDesignViewController.swift */,
78 | 93A34B3B2368B63500FE397D /* ColorsViewController.swift */,
79 | 938C300C237743F000DFC6D8 /* ColorStackViewController.swift */,
80 | 9368F025233966C70041AF64 /* AppDelegate.swift */,
81 | 9368F02E233966CB0041AF64 /* Assets.xcassets */,
82 | 9368F030233966CB0041AF64 /* LaunchScreen.storyboard */,
83 | 9368F033233966CB0041AF64 /* Info.plist */,
84 | 93FCD117237880F2005F3890 /* Helpers.swift */,
85 | E930F68F2A4CBC790031460F /* SwiftUIColorsView.swift */,
86 | );
87 | path = "Semantic Colors";
88 | sourceTree = "";
89 | };
90 | /* End PBXGroup section */
91 |
92 | /* Begin PBXNativeTarget section */
93 | 9368F021233966C70041AF64 /* Semantic Colors */ = {
94 | isa = PBXNativeTarget;
95 | buildConfigurationList = 9368F036233966CB0041AF64 /* Build configuration list for PBXNativeTarget "Semantic Colors" */;
96 | buildPhases = (
97 | 9368F01E233966C70041AF64 /* Sources */,
98 | 9368F01F233966C70041AF64 /* Frameworks */,
99 | 9368F020233966C70041AF64 /* Resources */,
100 | );
101 | buildRules = (
102 | );
103 | dependencies = (
104 | );
105 | name = "Semantic Colors";
106 | packageProductDependencies = (
107 | E930F6922A4CD36E0031460F /* SFSymbols */,
108 | );
109 | productName = "Semantic Colors";
110 | productReference = 9368F022233966C70041AF64 /* Semantic UI.app */;
111 | productType = "com.apple.product-type.application";
112 | };
113 | /* End PBXNativeTarget section */
114 |
115 | /* Begin PBXProject section */
116 | 9368F01A233966C70041AF64 /* Project object */ = {
117 | isa = PBXProject;
118 | attributes = {
119 | BuildIndependentTargetsInParallel = YES;
120 | LastSwiftUpdateCheck = 1100;
121 | LastUpgradeCheck = 1430;
122 | ORGANIZATIONNAME = "Cocoa Controls";
123 | TargetAttributes = {
124 | 9368F021233966C70041AF64 = {
125 | CreatedOnToolsVersion = 11.0;
126 | };
127 | };
128 | };
129 | buildConfigurationList = 9368F01D233966C70041AF64 /* Build configuration list for PBXProject "Semantic Colors" */;
130 | compatibilityVersion = "Xcode 9.3";
131 | developmentRegion = en;
132 | hasScannedForEncodings = 0;
133 | knownRegions = (
134 | en,
135 | Base,
136 | );
137 | mainGroup = 9368F019233966C70041AF64;
138 | packageReferences = (
139 | E930F6912A4CD36E0031460F /* XCRemoteSwiftPackageReference "SFSymbols" */,
140 | );
141 | productRefGroup = 9368F023233966C70041AF64 /* Products */;
142 | projectDirPath = "";
143 | projectRoot = "";
144 | targets = (
145 | 9368F021233966C70041AF64 /* Semantic Colors */,
146 | );
147 | };
148 | /* End PBXProject section */
149 |
150 | /* Begin PBXResourcesBuildPhase section */
151 | 9368F020233966C70041AF64 /* Resources */ = {
152 | isa = PBXResourcesBuildPhase;
153 | buildActionMask = 2147483647;
154 | files = (
155 | 9368F032233966CB0041AF64 /* LaunchScreen.storyboard in Resources */,
156 | 9368F02F233966CB0041AF64 /* Assets.xcassets in Resources */,
157 | );
158 | runOnlyForDeploymentPostprocessing = 0;
159 | };
160 | /* End PBXResourcesBuildPhase section */
161 |
162 | /* Begin PBXSourcesBuildPhase section */
163 | 9368F01E233966C70041AF64 /* Sources */ = {
164 | isa = PBXSourcesBuildPhase;
165 | buildActionMask = 2147483647;
166 | files = (
167 | E930F6902A4CBC790031460F /* SwiftUIColorsView.swift in Sources */,
168 | 938C300D237743F000DFC6D8 /* ColorStackViewController.swift in Sources */,
169 | 93FCD118237880F2005F3890 /* Helpers.swift in Sources */,
170 | 93A34B3C2368B63500FE397D /* ColorsViewController.swift in Sources */,
171 | 93A34B3E2368B65F00FE397D /* FontsViewController.swift in Sources */,
172 | 93FCD11A2378C096005F3890 /* DemosController.swift in Sources */,
173 | 9368F026233966C70041AF64 /* AppDelegate.swift in Sources */,
174 | 5B8E794D2BA971B10015306E /* FontsDesignViewController.swift in Sources */,
175 | 9368BC4B23761210002A14FE /* IconsViewController.swift in Sources */,
176 | 65634A442A4CA3DC005DDAD4 /* FontWeightViewController.swift in Sources */,
177 | );
178 | runOnlyForDeploymentPostprocessing = 0;
179 | };
180 | /* End PBXSourcesBuildPhase section */
181 |
182 | /* Begin PBXVariantGroup section */
183 | 9368F030233966CB0041AF64 /* LaunchScreen.storyboard */ = {
184 | isa = PBXVariantGroup;
185 | children = (
186 | 9368F031233966CB0041AF64 /* Base */,
187 | );
188 | name = LaunchScreen.storyboard;
189 | sourceTree = "";
190 | };
191 | /* End PBXVariantGroup section */
192 |
193 | /* Begin XCBuildConfiguration section */
194 | 9368F034233966CB0041AF64 /* Debug */ = {
195 | isa = XCBuildConfiguration;
196 | buildSettings = {
197 | ALWAYS_SEARCH_USER_PATHS = NO;
198 | CLANG_ANALYZER_NONNULL = YES;
199 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
200 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
201 | CLANG_CXX_LIBRARY = "libc++";
202 | CLANG_ENABLE_MODULES = YES;
203 | CLANG_ENABLE_OBJC_ARC = YES;
204 | CLANG_ENABLE_OBJC_WEAK = YES;
205 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
206 | CLANG_WARN_BOOL_CONVERSION = YES;
207 | CLANG_WARN_COMMA = YES;
208 | CLANG_WARN_CONSTANT_CONVERSION = YES;
209 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
210 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
211 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
212 | CLANG_WARN_EMPTY_BODY = YES;
213 | CLANG_WARN_ENUM_CONVERSION = YES;
214 | CLANG_WARN_INFINITE_RECURSION = YES;
215 | CLANG_WARN_INT_CONVERSION = YES;
216 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
217 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
218 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
219 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
220 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
221 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
222 | CLANG_WARN_STRICT_PROTOTYPES = YES;
223 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
224 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
225 | CLANG_WARN_UNREACHABLE_CODE = YES;
226 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
227 | COPY_PHASE_STRIP = NO;
228 | DEBUG_INFORMATION_FORMAT = dwarf;
229 | ENABLE_STRICT_OBJC_MSGSEND = YES;
230 | ENABLE_TESTABILITY = YES;
231 | GCC_C_LANGUAGE_STANDARD = gnu11;
232 | GCC_DYNAMIC_NO_PIC = NO;
233 | GCC_NO_COMMON_BLOCKS = YES;
234 | GCC_OPTIMIZATION_LEVEL = 0;
235 | GCC_PREPROCESSOR_DEFINITIONS = (
236 | "DEBUG=1",
237 | "$(inherited)",
238 | );
239 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
240 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
241 | GCC_WARN_UNDECLARED_SELECTOR = YES;
242 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
243 | GCC_WARN_UNUSED_FUNCTION = YES;
244 | GCC_WARN_UNUSED_VARIABLE = YES;
245 | IPHONEOS_DEPLOYMENT_TARGET = 16.0;
246 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
247 | MTL_FAST_MATH = YES;
248 | ONLY_ACTIVE_ARCH = YES;
249 | SDKROOT = iphoneos;
250 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
251 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
252 | };
253 | name = Debug;
254 | };
255 | 9368F035233966CB0041AF64 /* Release */ = {
256 | isa = XCBuildConfiguration;
257 | buildSettings = {
258 | ALWAYS_SEARCH_USER_PATHS = NO;
259 | CLANG_ANALYZER_NONNULL = YES;
260 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
261 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
262 | CLANG_CXX_LIBRARY = "libc++";
263 | CLANG_ENABLE_MODULES = YES;
264 | CLANG_ENABLE_OBJC_ARC = YES;
265 | CLANG_ENABLE_OBJC_WEAK = YES;
266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
267 | CLANG_WARN_BOOL_CONVERSION = YES;
268 | CLANG_WARN_COMMA = YES;
269 | CLANG_WARN_CONSTANT_CONVERSION = YES;
270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
272 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
273 | CLANG_WARN_EMPTY_BODY = YES;
274 | CLANG_WARN_ENUM_CONVERSION = YES;
275 | CLANG_WARN_INFINITE_RECURSION = YES;
276 | CLANG_WARN_INT_CONVERSION = YES;
277 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
278 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
279 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
280 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
281 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
283 | CLANG_WARN_STRICT_PROTOTYPES = YES;
284 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
285 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
286 | CLANG_WARN_UNREACHABLE_CODE = YES;
287 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
288 | COPY_PHASE_STRIP = NO;
289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
290 | ENABLE_NS_ASSERTIONS = NO;
291 | ENABLE_STRICT_OBJC_MSGSEND = YES;
292 | GCC_C_LANGUAGE_STANDARD = gnu11;
293 | GCC_NO_COMMON_BLOCKS = YES;
294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
296 | GCC_WARN_UNDECLARED_SELECTOR = YES;
297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
298 | GCC_WARN_UNUSED_FUNCTION = YES;
299 | GCC_WARN_UNUSED_VARIABLE = YES;
300 | IPHONEOS_DEPLOYMENT_TARGET = 16.0;
301 | MTL_ENABLE_DEBUG_INFO = NO;
302 | MTL_FAST_MATH = YES;
303 | SDKROOT = iphoneos;
304 | SWIFT_COMPILATION_MODE = wholemodule;
305 | SWIFT_OPTIMIZATION_LEVEL = "-O";
306 | VALIDATE_PRODUCT = YES;
307 | };
308 | name = Release;
309 | };
310 | 9368F037233966CB0041AF64 /* Debug */ = {
311 | isa = XCBuildConfiguration;
312 | buildSettings = {
313 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
314 | CODE_SIGN_STYLE = Automatic;
315 | INFOPLIST_FILE = "Semantic Colors/Info.plist";
316 | IPHONEOS_DEPLOYMENT_TARGET = 16.0;
317 | LD_RUNPATH_SEARCH_PATHS = (
318 | "$(inherited)",
319 | "@executable_path/Frameworks",
320 | );
321 | PRODUCT_BUNDLE_IDENTIFIER = "com.cocoacontrols.Semantic-UI";
322 | PRODUCT_NAME = "Semantic UI";
323 | SWIFT_VERSION = 5.0;
324 | TARGETED_DEVICE_FAMILY = "1,2";
325 | };
326 | name = Debug;
327 | };
328 | 9368F038233966CB0041AF64 /* Release */ = {
329 | isa = XCBuildConfiguration;
330 | buildSettings = {
331 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
332 | CODE_SIGN_STYLE = Automatic;
333 | INFOPLIST_FILE = "Semantic Colors/Info.plist";
334 | IPHONEOS_DEPLOYMENT_TARGET = 16.0;
335 | LD_RUNPATH_SEARCH_PATHS = (
336 | "$(inherited)",
337 | "@executable_path/Frameworks",
338 | );
339 | PRODUCT_BUNDLE_IDENTIFIER = "com.cocoacontrols.Semantic-UI";
340 | PRODUCT_NAME = "Semantic UI";
341 | SWIFT_VERSION = 5.0;
342 | TARGETED_DEVICE_FAMILY = "1,2";
343 | };
344 | name = Release;
345 | };
346 | /* End XCBuildConfiguration section */
347 |
348 | /* Begin XCConfigurationList section */
349 | 9368F01D233966C70041AF64 /* Build configuration list for PBXProject "Semantic Colors" */ = {
350 | isa = XCConfigurationList;
351 | buildConfigurations = (
352 | 9368F034233966CB0041AF64 /* Debug */,
353 | 9368F035233966CB0041AF64 /* Release */,
354 | );
355 | defaultConfigurationIsVisible = 0;
356 | defaultConfigurationName = Release;
357 | };
358 | 9368F036233966CB0041AF64 /* Build configuration list for PBXNativeTarget "Semantic Colors" */ = {
359 | isa = XCConfigurationList;
360 | buildConfigurations = (
361 | 9368F037233966CB0041AF64 /* Debug */,
362 | 9368F038233966CB0041AF64 /* Release */,
363 | );
364 | defaultConfigurationIsVisible = 0;
365 | defaultConfigurationName = Release;
366 | };
367 | /* End XCConfigurationList section */
368 |
369 | /* Begin XCRemoteSwiftPackageReference section */
370 | E930F6912A4CD36E0031460F /* XCRemoteSwiftPackageReference "SFSymbols" */ = {
371 | isa = XCRemoteSwiftPackageReference;
372 | repositoryURL = "https://github.com/Rspoon3/SFSymbols";
373 | requirement = {
374 | kind = upToNextMajorVersion;
375 | minimumVersion = 2.0.0;
376 | };
377 | };
378 | /* End XCRemoteSwiftPackageReference section */
379 |
380 | /* Begin XCSwiftPackageProductDependency section */
381 | E930F6922A4CD36E0031460F /* SFSymbols */ = {
382 | isa = XCSwiftPackageProductDependency;
383 | package = E930F6912A4CD36E0031460F /* XCRemoteSwiftPackageReference "SFSymbols" */;
384 | productName = SFSymbols;
385 | };
386 | /* End XCSwiftPackageProductDependency section */
387 | };
388 | rootObject = 9368F01A233966C70041AF64 /* Project object */;
389 | }
390 |
--------------------------------------------------------------------------------
/Semantic Colors.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Semantic Colors.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/Semantic Colors.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved:
--------------------------------------------------------------------------------
1 | {
2 | "pins" : [
3 | {
4 | "identity" : "sfsymbols",
5 | "kind" : "remoteSourceControl",
6 | "location" : "https://github.com/Rspoon3/SFSymbols",
7 | "state" : {
8 | "revision" : "af0753a21275a6ae0224771e9c5d4ebb06e3c181",
9 | "version" : "2.3.0"
10 | }
11 | }
12 | ],
13 | "version" : 2
14 | }
15 |
--------------------------------------------------------------------------------
/Semantic Colors/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.swift
3 | // Semantic Colors
4 | //
5 | // Created by Aaron Brethorst on 9/23/19.
6 | // Copyright © 2019 Cocoa Controls. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import SwiftUI
11 |
12 | @UIApplicationMain
13 | class AppDelegate: UIResponder, UIApplicationDelegate {
14 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
15 | return true
16 | }
17 |
18 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
19 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
20 | }
21 | }
22 |
23 | class PrimarySplitViewController: UISplitViewController,
24 | UISplitViewControllerDelegate {
25 |
26 | override func viewDidLoad() {
27 | super.viewDidLoad()
28 | self.delegate = self
29 | self.preferredDisplayMode = .oneBesideSecondary
30 | }
31 |
32 | func splitViewController(
33 | _ splitViewController: UISplitViewController,
34 | collapseSecondary secondaryViewController: UIViewController,
35 | onto primaryViewController: UIViewController) -> Bool {
36 | // Return true to prevent UIKit from applying its default behavior
37 | return true
38 | }
39 | }
40 |
41 | class SceneDelegate: UIResponder, UIWindowSceneDelegate {
42 | var window: UIWindow?
43 |
44 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
45 | guard let scene = scene as? UIWindowScene else { fatalError() }
46 |
47 | let window = UIWindow(windowScene: scene)
48 |
49 | let semanticUIDemos = [
50 | ColorStackViewController(),
51 | ColorsViewController(),
52 | SwiftUIColorsView.hostingController,
53 | FontsViewController(),
54 | FontsWeightViewController(),
55 | FontsDesignViewController(),
56 | IconsViewController()
57 | ]
58 |
59 | let demosController = DemosController(nibName: nil, bundle: nil)
60 | demosController.demoControllers = semanticUIDemos
61 |
62 | let splitController = PrimarySplitViewController()
63 | splitController.viewControllers = [UINavigationController(rootViewController: demosController), UINavigationController(rootViewController: semanticUIDemos[0])]
64 |
65 | demosController.demoControllerSelected = { controller in
66 | splitController.showDetailViewController(UINavigationController(rootViewController: controller), sender: nil)
67 | }
68 |
69 | window.rootViewController = splitController
70 |
71 | self.window = window
72 | window.makeKeyAndVisible()
73 | }
74 |
75 | func sceneDidDisconnect(_ scene: UIScene) {
76 | // Called as the scene is being released by the system.
77 | // This occurs shortly after the scene enters the background, or when its session is discarded.
78 | // Release any resources associated with this scene that can be re-created the next time the scene connects.
79 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead).
80 | }
81 |
82 | func sceneDidBecomeActive(_ scene: UIScene) {
83 | // Called when the scene has moved from an inactive state to an active state.
84 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
85 | }
86 |
87 | func sceneWillResignActive(_ scene: UIScene) {
88 | // Called when the scene will move from an active state to an inactive state.
89 | // This may occur due to temporary interruptions (ex. an incoming phone call).
90 | }
91 |
92 | func sceneWillEnterForeground(_ scene: UIScene) {
93 | // Called as the scene transitions from the background to the foreground.
94 | // Use this method to undo the changes made on entering the background.
95 | }
96 |
97 | func sceneDidEnterBackground(_ scene: UIScene) {
98 | // Called as the scene transitions from the foreground to the background.
99 | // Use this method to save data, release shared resources, and store enough scene-specific state information
100 | // to restore the scene back to its current state.
101 | }
102 |
103 |
104 | }
105 |
106 |
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "filename" : "icon_20pt@2x.png",
5 | "idiom" : "iphone",
6 | "scale" : "2x",
7 | "size" : "20x20"
8 | },
9 | {
10 | "filename" : "icon_20pt@3x.png",
11 | "idiom" : "iphone",
12 | "scale" : "3x",
13 | "size" : "20x20"
14 | },
15 | {
16 | "filename" : "icon_29pt.png",
17 | "idiom" : "iphone",
18 | "scale" : "1x",
19 | "size" : "29x29"
20 | },
21 | {
22 | "filename" : "icon_29pt@2x.png",
23 | "idiom" : "iphone",
24 | "scale" : "2x",
25 | "size" : "29x29"
26 | },
27 | {
28 | "filename" : "icon_29pt@3x.png",
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "29x29"
32 | },
33 | {
34 | "filename" : "icon_40pt@2x.png",
35 | "idiom" : "iphone",
36 | "scale" : "2x",
37 | "size" : "40x40"
38 | },
39 | {
40 | "filename" : "icon_40pt@3x.png",
41 | "idiom" : "iphone",
42 | "scale" : "3x",
43 | "size" : "40x40"
44 | },
45 | {
46 | "filename" : "icon_60pt@2x.png",
47 | "idiom" : "iphone",
48 | "scale" : "2x",
49 | "size" : "60x60"
50 | },
51 | {
52 | "filename" : "icon_60pt@3x.png",
53 | "idiom" : "iphone",
54 | "scale" : "3x",
55 | "size" : "60x60"
56 | },
57 | {
58 | "filename" : "icon_20pt.png",
59 | "idiom" : "ipad",
60 | "scale" : "1x",
61 | "size" : "20x20"
62 | },
63 | {
64 | "filename" : "icon_20pt@2x-1.png",
65 | "idiom" : "ipad",
66 | "scale" : "2x",
67 | "size" : "20x20"
68 | },
69 | {
70 | "filename" : "icon_29pt-1.png",
71 | "idiom" : "ipad",
72 | "scale" : "1x",
73 | "size" : "29x29"
74 | },
75 | {
76 | "filename" : "icon_29pt@2x-1.png",
77 | "idiom" : "ipad",
78 | "scale" : "2x",
79 | "size" : "29x29"
80 | },
81 | {
82 | "filename" : "icon_40pt.png",
83 | "idiom" : "ipad",
84 | "scale" : "1x",
85 | "size" : "40x40"
86 | },
87 | {
88 | "filename" : "icon_40pt@2x-1.png",
89 | "idiom" : "ipad",
90 | "scale" : "2x",
91 | "size" : "40x40"
92 | },
93 | {
94 | "filename" : "icon_76pt.png",
95 | "idiom" : "ipad",
96 | "scale" : "1x",
97 | "size" : "76x76"
98 | },
99 | {
100 | "filename" : "icon_76pt@2x.png",
101 | "idiom" : "ipad",
102 | "scale" : "2x",
103 | "size" : "76x76"
104 | },
105 | {
106 | "filename" : "icon_83.5@2x.png",
107 | "idiom" : "ipad",
108 | "scale" : "2x",
109 | "size" : "83.5x83.5"
110 | },
111 | {
112 | "filename" : "icon_App store.png",
113 | "idiom" : "ios-marketing",
114 | "scale" : "1x",
115 | "size" : "1024x1024"
116 | }
117 | ],
118 | "info" : {
119 | "author" : "xcode",
120 | "version" : 1
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_20pt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_20pt.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x-1.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_20pt@2x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_20pt@3x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt-1.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x-1.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt@2x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_29pt@3x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_40pt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_40pt.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x-1.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_40pt@2x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_40pt@3x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_60pt@2x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_60pt@3x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_76pt.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_76pt.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_76pt@2x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_83.5@2x.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_App store.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cocoacontrols/SemanticUI/376e8506f506faa63eac97e4b19c321d3cac05d4/Semantic Colors/Assets.xcassets/AppIcon.appiconset/icon_App store.png
--------------------------------------------------------------------------------
/Semantic Colors/Assets.xcassets/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "info" : {
3 | "version" : 1,
4 | "author" : "xcode"
5 | }
6 | }
--------------------------------------------------------------------------------
/Semantic Colors/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 |
--------------------------------------------------------------------------------
/Semantic Colors/ColorStackViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ColorStackViewController.swift
3 | // Semantic Colors
4 | //
5 | // Created by Aaron Brethorst on 11/9/19.
6 | // Copyright © 2019 Cocoa Controls. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ColorStackViewController: UIViewController {
12 | // MARK: - UIViewController
13 |
14 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
15 | super.init(nibName: nil, bundle: nil)
16 |
17 | title = NSLocalizedString("color_stack.title", value: "Color Stack", comment: "Color Stack controller title")
18 | tabBarItem.image = UIImage(systemName: "square.stack.3d.up")
19 | tabBarItem.selectedImage = UIImage(systemName: "square.stack.3d.up.fill")
20 | }
21 |
22 | required init?(coder: NSCoder) {
23 | fatalError("init(coder:) has not been implemented")
24 | }
25 |
26 | override func viewDidLoad() {
27 | super.viewDidLoad()
28 |
29 | additionalSafeAreaInsets = UIEdgeInsets(top: UIView.defaultPadding, left: 0, bottom: UIView.defaultPadding, right: 0)
30 |
31 | view.backgroundColor = .systemBackground
32 |
33 | view.addSubview(primaryStack)
34 | primaryStack.pinToSuperviewLayoutMargins()
35 | }
36 |
37 | // MARK: - UI Properties
38 |
39 | private lazy var primaryLabel = buildLabel(text: "Title (.label)", textStyle: .headline, textColor: .label)
40 | private lazy var secondaryLabel = buildLabel(text: "Subtitle (.secondaryLabel)", textStyle: .headline, textColor: .secondaryLabel)
41 | private lazy var tertiaryLabel = buildLabel(text: "Placeholder (.tertiaryLabel)", textStyle: .headline, textColor: .tertiaryLabel)
42 | private lazy var placeholderLabel = buildLabel(text: "Placeholder 🤷♂️ (.placeholderText)", textStyle: .headline, textColor: .placeholderText)
43 | private lazy var quaternaryLabel = buildLabel(text: "Disabled (.quaternaryLabel)", textStyle: .headline, textColor: .quaternaryLabel)
44 |
45 | private lazy var separator: UIView = {
46 | let view = UIView.autolayoutNew()
47 | view.backgroundColor = .separator
48 | NSLayoutConstraint.activate([
49 | view.heightAnchor.constraint(equalToConstant: 1.0)
50 | ])
51 | return view
52 | }()
53 |
54 | private lazy var primaryBackgroundLabel = buildLabel(text: ".systemBackground")
55 |
56 | private lazy var secondaryContainer: UIView = {
57 | let view = buildContainer(backgroundColor: .secondarySystemBackground)
58 | view.addSubview(secondaryStack)
59 | secondaryStack.pinToSuperviewLayoutMargins()
60 | return view
61 | }()
62 |
63 | private lazy var secondaryBackgroundLabel = buildLabel(text: ".secondarySystemBackground")
64 |
65 | private lazy var tertiaryContainer: UIView = {
66 | let view = buildContainer(backgroundColor: .tertiarySystemBackground)
67 | view.addSubview(tertiaryStack)
68 | tertiaryStack.pinToSuperviewLayoutMargins()
69 |
70 | return view
71 | }()
72 |
73 | private lazy var tertiaryBackgroundLabel = buildLabel(text: ".tertiarySystemBackground")
74 |
75 | private lazy var primaryStack = UIStackView.verticalStack(arrangedSubviews: [primaryLabel, secondaryLabel, tertiaryLabel, placeholderLabel, quaternaryLabel, separator, primaryBackgroundLabel, secondaryContainer])
76 |
77 | private lazy var secondaryStack = UIStackView.verticalStack(arrangedSubviews: [secondaryBackgroundLabel, tertiaryContainer])
78 |
79 | private lazy var tertiaryStack = UIStackView.verticalStack(arrangedSubviews: [tertiaryBackgroundLabel, UIView.autolayoutNew()])
80 |
81 | // MARK: - Private UI Helpers
82 |
83 | private func buildLabel(text: String, textStyle: UIFont.TextStyle = .footnote, textColor: UIColor = .label) -> UILabel {
84 | let label = UILabel.autolayoutNew()
85 | label.font = UIFont.preferredFont(forTextStyle: textStyle)
86 | label.textColor = textColor
87 | label.setContentHuggingPriority(.required, for: .vertical)
88 | label.text = text
89 | return label
90 | }
91 |
92 | private func buildContainer(backgroundColor: UIColor) -> UIView {
93 | let container = UIView.autolayoutNew()
94 | container.backgroundColor = backgroundColor
95 | container.layer.cornerRadius = UIView.defaultCornerRadius
96 | container.directionalLayoutMargins = UIView.defaultDirectionalLayoutMargins
97 | return container
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/Semantic Colors/ColorsViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // ColorsViewController.swift
3 | // Semantic Colors
4 | //
5 | // Created by Aaron Brethorst on 9/23/19.
6 | // Copyright © 2019 Cocoa Controls. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class ColorsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
12 |
13 | // MARK: - Sections
14 |
15 | private lazy var tableSections: [TableSection] = [
16 | TableSection(name: "Adaptable Colors", rows: adaptableColors),
17 | TableSection(name: "Adaptable Colors for iOS 15", rows: newAdaptableColorsForIOS15),
18 | TableSection(name: "Adaptable Grays", rows: adaptableGrays),
19 | TableSection(name: "Label Colors", rows: labelColors),
20 | TableSection(name: "Text Colors", rows: textColors),
21 | TableSection(name: "Link Color", rows: linkColor),
22 | TableSection(name: "Separators", rows: separators),
23 | TableSection(name: "Fill Colors", rows: fillColors),
24 | TableSection(name: "Background Colors", rows: backgroundColors),
25 | TableSection(name: "Grouped Background Colors", rows: groupedBackgroundColors),
26 | TableSection(name: "Non-Adaptable Colors", rows: nonadaptableColors)
27 | ]
28 |
29 | // MARK: - Adaptable Colors
30 |
31 | /// Some colors that are used by system elements and applications.
32 | /// These return named colors whose values may vary between different contexts and releases.
33 | /// Do not make assumptions about the color spaces or actual colors used.
34 | private lazy var adaptableColors: [UITableViewCell] = {
35 | var cells = [UITableViewCell]()
36 |
37 | cells.append(buildCell(name: ".systemRed", backgroundColor: .systemRed))
38 | cells.append(buildCell(name: ".systemGreen", backgroundColor: .systemGreen))
39 | cells.append(buildCell(name: ".systemBlue", backgroundColor: .systemBlue))
40 | cells.append(buildCell(name: ".systemIndigo", backgroundColor: .systemIndigo))
41 | cells.append(buildCell(name: ".systemOrange", backgroundColor: .systemOrange))
42 | cells.append(buildCell(name: ".systemPink", backgroundColor: .systemPink))
43 | cells.append(buildCell(name: ".systemPurple", backgroundColor: .systemPurple))
44 | cells.append(buildCell(name: ".systemTeal", backgroundColor: .systemTeal))
45 | cells.append(buildCell(name: ".systemYellow", backgroundColor: .systemYellow))
46 |
47 |
48 | return cells
49 | }()
50 |
51 | /// New adaptable colors for iOS 15
52 | private lazy var newAdaptableColorsForIOS15: [UITableViewCell] = {
53 | var cells = [UITableViewCell]()
54 |
55 | if #available(iOS 15, *) {
56 | cells.append(buildCell(name: ".systemMint", backgroundColor: .systemMint))
57 | cells.append(buildCell(name: ".systemCyan", backgroundColor: .systemCyan))
58 | cells.append(buildCell(name: ".systemBrown", backgroundColor: .systemBrown))
59 | }
60 |
61 | return cells
62 | }()
63 |
64 | // MARK: - Adaptable Grays
65 |
66 | /// Shades of gray. systemGray is the base gray color.
67 | ///
68 | /// The numbered variations, systemGray2 through systemGray6, are grays which increasingly
69 | /// trend away from systemGray and in the direction of systemBackgroundColor.
70 | ///
71 | /// In UIUserInterfaceStyleLight: systemGray1 is slightly lighter than systemGray. systemGray2 is lighter than that, and so on.
72 | /// In UIUserInterfaceStyleDark: systemGray1 is slightly darker than systemGray. systemGray2 is darker than that, and so on.
73 | private lazy var adaptableGrays: [UITableViewCell] = {
74 | var cells = [UITableViewCell]()
75 |
76 | cells.append(buildCell(name: ".systemGray", backgroundColor: .systemGray))
77 | cells.append(buildCell(name: ".systemGray2", backgroundColor: .systemGray2))
78 | cells.append(buildCell(name: ".systemGray3", backgroundColor: .systemGray3))
79 | cells.append(buildCell(name: ".systemGray4", backgroundColor: .systemGray4))
80 | cells.append(buildCell(name: ".systemGray5", backgroundColor: .systemGray5))
81 | cells.append(buildCell(name: ".systemGray6", backgroundColor: .systemGray6))
82 |
83 | return cells
84 | }()
85 |
86 | // MARK: - Label Colors
87 |
88 | /// Foreground colors for static text and related elements.
89 | private lazy var labelColors: [UITableViewCell] = {
90 | var cells = [UITableViewCell]()
91 |
92 | cells.append(buildCell(name: ".label", textColor: .label))
93 | cells.append(buildCell(name: ".secondaryLabel", textColor: .secondaryLabel))
94 | cells.append(buildCell(name: ".tertiaryLabel", textColor: .tertiaryLabel))
95 | cells.append(buildCell(name: ".quaternaryLabel", textColor: .quaternaryLabel))
96 |
97 | return cells
98 | }()
99 |
100 | // MARK: - Link Color
101 |
102 | /// Foreground color for standard system links.
103 | private lazy var linkColor: [UITableViewCell] = {
104 | var cells = [UITableViewCell]()
105 |
106 | cells.append(buildCell(name: ".link", textColor: .link))
107 |
108 | return cells
109 | }()
110 |
111 | // MARK: - Text Colors
112 |
113 | /// Foreground color for placeholder text in controls or text fields or text views.
114 | private lazy var textColors: [UITableViewCell] = {
115 | var cells = [UITableViewCell]()
116 |
117 | cells.append(buildCell(name: ".placeholderText", textColor: .placeholderText))
118 |
119 | return cells
120 | }()
121 |
122 | // MARK: - Separators
123 |
124 | /// Foreground colors for separators (thin border or divider lines).
125 | /// `separatorColor` may be partially transparent, so it can go on top of any content.
126 | /// `opaqueSeparatorColor` is intended to look similar, but is guaranteed to be opaque, so it will
127 | /// completely cover anything behind it. Depending on the situation, you may need one or the other.
128 | private lazy var separators: [UITableViewCell] = {
129 | var cells = [UITableViewCell]()
130 |
131 | cells.append(buildCell(name: ".separator", backgroundColor: .separator))
132 | cells.append(buildCell(name: ".opaqueSeparator", backgroundColor: .opaqueSeparator))
133 |
134 | return cells
135 | }()
136 |
137 | // MARK: - Fill Colors
138 |
139 | /// Fill colors for UI elements.
140 | ///
141 | /// These are meant to be used over the background colors, since their alpha component is less than 1.
142 | ///
143 | /// systemFillColor is appropriate for filling thin and small shapes.
144 | /// Example: The track of a slider.
145 | ///
146 | /// secondarySystemFillColor is appropriate for filling medium-size shapes.
147 | /// Example: The background of a switch.
148 | ///
149 | /// tertiarySystemFillColor is appropriate for filling large shapes.
150 | /// Examples: Input fields, search bars, buttons.
151 | ///
152 | /// quaternarySystemFillColor is appropriate for filling large areas containing complex content.
153 | /// Example: Expanded table cells.
154 | private lazy var fillColors: [UITableViewCell] = {
155 | var cells = [UITableViewCell]()
156 |
157 | cells.append(buildCell(name: ".systemFill", backgroundColor: .systemFill))
158 | cells.append(buildCell(name: ".secondarySystemFill", backgroundColor: .secondarySystemFill))
159 | cells.append(buildCell(name: ".tertiarySystemFill", backgroundColor: .tertiarySystemFill))
160 | cells.append(buildCell(name: ".quaternarySystemFill", backgroundColor: .quaternarySystemFill))
161 |
162 | return cells
163 | }()
164 |
165 | // MARK: - Background Colors
166 |
167 | /// We provide two design systems (also known as "stacks") for structuring an iOS app's backgrounds.
168 | ///
169 | /// Each stack has three "levels" of background colors. The first color is intended to be the
170 | /// main background, farthest back. Secondary and tertiary colors are layered on top
171 | /// of the main background, when appropriate.
172 | ///
173 | /// Inside of a discrete piece of UI, choose a stack, then use colors from that stack.
174 | /// We do not recommend mixing and matching background colors between stacks.
175 | /// The foreground colors above are designed to work in both stacks.
176 | ///
177 | /// 1. systemBackground
178 | /// Use this stack for views with standard table views, and designs which have a white
179 | /// primary background in light mode.
180 | private lazy var backgroundColors: [UITableViewCell] = {
181 | var cells = [UITableViewCell]()
182 |
183 | cells.append(buildCell(name: ".systemBackground", backgroundColor: .systemBackground))
184 | cells.append(buildCell(name: ".secondarySystemBackground", backgroundColor: .secondarySystemBackground))
185 | cells.append(buildCell(name: ".tertiarySystemBackground", backgroundColor: .tertiarySystemBackground))
186 |
187 | return cells
188 | }()
189 |
190 | // MARK: - Grouped Background Colors
191 |
192 | /// 2. systemGroupedBackground
193 | /// Use this stack for views with grouped content, such as grouped tables and
194 | /// platter-based designs. These are like grouped table views, but you may use these
195 | /// colors in places where a table view wouldn't make sense.
196 | private lazy var groupedBackgroundColors: [UITableViewCell] = {
197 | var cells = [UITableViewCell]()
198 |
199 | cells.append(buildCell(name: ".systemGroupedBackground", backgroundColor: .systemGroupedBackground))
200 | cells.append(buildCell(name: ".secondarySystemGroupedBackground", backgroundColor: .secondarySystemGroupedBackground))
201 | cells.append(buildCell(name: ".tertiarySystemGroupedBackground", backgroundColor: .tertiarySystemGroupedBackground))
202 |
203 | return cells
204 | }()
205 |
206 | // MARK: - Non-Adaptable Colors
207 |
208 | /// lightTextColor is always light, and darkTextColor is always dark, regardless of the current UIUserInterfaceStyle.
209 | /// When possible, we recommend using `labelColor` and its variants, instead.
210 | private lazy var nonadaptableColors: [UITableViewCell] = {
211 | var cells = [UITableViewCell]()
212 |
213 | cells.append(buildCell(name: ".lightText", backgroundColor: .black, textColor: .lightText))
214 | cells.append(buildCell(name: ".darkText", backgroundColor: .white, textColor: .darkText))
215 |
216 | return cells
217 | }()
218 |
219 | // MARK: - UIViewController
220 |
221 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
222 | super.init(nibName: nil, bundle: nil)
223 |
224 | title = NSLocalizedString("colors_controller.title", value: "Colors", comment: "Colors controller title")
225 | tabBarItem.image = UIImage(systemName: "eyedropper")
226 | }
227 |
228 | required init?(coder: NSCoder) {
229 | fatalError("init(coder:) has not been implemented")
230 | }
231 |
232 | override func viewDidLoad() {
233 | super.viewDidLoad()
234 |
235 | view.addSubview(tableView)
236 | tableView.frame = view.bounds
237 | tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
238 | }
239 |
240 | // MARK: - Table View
241 |
242 | private lazy var tableView: UITableView = {
243 | let table = UITableView()
244 | table.dataSource = self
245 | table.delegate = self
246 | table.allowsSelection = false
247 | return table
248 | }()
249 |
250 | func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
251 | tableSections[section].name
252 | }
253 |
254 | func numberOfSections(in tableView: UITableView) -> Int {
255 | tableSections.count
256 | }
257 |
258 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
259 | tableSections[section].rows.count
260 | }
261 |
262 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
263 | tableSections[indexPath.section].rows[indexPath.row]
264 | }
265 | }
266 |
267 | // MARK: - Helpers
268 |
269 | fileprivate struct TableSection {
270 | let name: String
271 | let rows: [UITableViewCell]
272 | }
273 |
274 | fileprivate func buildCell(name: String, backgroundColor: UIColor? = nil, textColor: UIColor? = nil) -> UITableViewCell {
275 | let cell = UITableViewCell(style: .default, reuseIdentifier: nil)
276 |
277 | if let backgroundColor = backgroundColor {
278 | cell.backgroundColor = backgroundColor
279 | }
280 |
281 | cell.textLabel?.text = name
282 |
283 | if let textColor = textColor {
284 | cell.textLabel?.textColor = textColor
285 | }
286 |
287 | return cell
288 | }
289 |
--------------------------------------------------------------------------------
/Semantic Colors/DemosController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // DemosController.swift
3 | // Semantic Colors
4 | //
5 | // Created by Aaron Brethorst on 11/10/19.
6 | // Copyright © 2019 Cocoa Controls. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class DemosController: UITableViewController {
12 | private let cellIdentifier = "identifier"
13 |
14 | var demoControllers = [UIViewController]()
15 |
16 | var demoControllerSelected: ((UIViewController) -> Void)?
17 |
18 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
19 | super.init(style: .insetGrouped)
20 |
21 | title = NSLocalizedString("demos_controller.title", value: "Semantic UI Demos", comment: "Demos controller title")
22 | }
23 |
24 | required init?(coder: NSCoder) {
25 | fatalError("init(coder:) has not been implemented")
26 | }
27 |
28 | override func viewDidLoad() {
29 | super.viewDidLoad()
30 |
31 | tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier)
32 |
33 | tableView.tableFooterView = UIView()
34 | }
35 |
36 | override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
37 | demoControllers.count
38 | }
39 |
40 | override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
41 | let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath)
42 | cell.imageView?.image = demoControllers[indexPath.row].tabBarItem.image
43 | cell.textLabel?.text = demoControllers[indexPath.row].title
44 | cell.accessoryType = .disclosureIndicator
45 |
46 | return cell
47 | }
48 |
49 | override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
50 | demoControllerSelected?(demoControllers[indexPath.row])
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Semantic Colors/FontWeightViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FontsWeightViewController.swift
3 | // Semantic Colors
4 | //
5 | // Created by JINSEOK on 2023/06/29.
6 | // Copyright © 2023 Cocoa Controls. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class FontsWeightViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
12 |
13 | // MARK: - Table Rows
14 |
15 | private lazy var rows: [UITableViewCell] = [
16 | buildCell(name: "Ultra Light", weight: .ultraLight),
17 | buildCell(name: "Thin", weight: .thin),
18 | buildCell(name: "Light", weight: .light),
19 | buildCell(name: "Regular", weight: .regular),
20 | buildCell(name: "Medium", weight: .medium),
21 | buildCell(name: "Semibold", weight: .semibold),
22 | buildCell(name: "Bold", weight: .bold),
23 | buildCell(name: "Heavy", weight: .heavy),
24 | buildCell(name: "Black", weight: .black)
25 | ]
26 |
27 | // MARK: - UIViewController
28 |
29 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
30 | super.init(nibName: nil, bundle: nil)
31 |
32 | title = "Fonts Weight"
33 | tabBarItem.image = UIImage(systemName: "character.cursor.ibeam")
34 | }
35 |
36 | required init?(coder: NSCoder) {
37 | fatalError("init(coder:) has not been implemented")
38 | }
39 |
40 | override func viewDidLoad() {
41 | super.viewDidLoad()
42 |
43 | view.addSubview(tableView)
44 | tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
45 | }
46 |
47 | // MARK: - Table View
48 |
49 | private lazy var tableView: UITableView = {
50 | let table = UITableView(frame: view.bounds, style: .insetGrouped)
51 | table.dataSource = self
52 | table.delegate = self
53 | table.allowsSelection = false
54 | return table
55 | }()
56 |
57 |
58 | func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
59 | return buildHeader()
60 | }
61 |
62 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
63 | return rows.count
64 | }
65 |
66 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
67 | return rows[indexPath.row]
68 | }
69 | }
70 |
71 | // MARK: - Helpers
72 |
73 | extension FontsWeightViewController {
74 | private func buildHeader() -> UITableViewHeaderFooterView {
75 | let header = UITableViewHeaderFooterView(reuseIdentifier: nil)
76 | header.textLabel?.numberOfLines = 0
77 |
78 | header.textLabel?.text = """
79 | font weight value range is from -1.0 to 1.0,
80 | where 0.0 corresponds to the regular font weight.
81 | The negative side of the value range indicates that the font is light or thin, the positive side means the font is heavier or bolder.
82 | """
83 | return header
84 | }
85 |
86 | private func buildCell(name: String, weight: UIFont.Weight) -> UITableViewCell {
87 | let cell = UITableViewCell(style: .subtitle, reuseIdentifier: nil)
88 |
89 | cell.textLabel?.text = name
90 | cell.textLabel?.font = UIFont.systemFont(ofSize: 17, weight: weight)
91 | cell.detailTextLabel?.text = calcFontWeight(font: weight)
92 | return cell
93 | }
94 |
95 | /// Sets the font weight based on UIFont.preferredFont(forTextStyle: .body) == Point size: 17
96 | /// For a detailed description of the calculated values, see Discussion on the link
97 | /// https://developer.apple.com/documentation/uikit/uifontdescriptor/traitkey/1616668-weight
98 | private func calcFontWeight(font: UIFont.Weight) -> String? {
99 | let font = UIFont.systemFont(ofSize: 17, weight: font)
100 | guard let fontDescriptor = font.fontDescriptor.object(forKey: .traits) as? [UIFontDescriptor.TraitKey: Any],
101 | let weightValue = fontDescriptor[.weight] as? NSNumber
102 | else {
103 | print("Failed to retrieve font weight")
104 | return nil
105 | }
106 | let weight = weightValue.floatValue
107 | return String(stringLiteral: "Font weight: \(weight)")
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/Semantic Colors/FontsDesignViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FontsDesignViewController.swift
3 | // Semantic Colors
4 | //
5 | // Created by Aswani G on 3/18/24.
6 | // Copyright © 2024 Cocoa Controls. All rights reserved.
7 | //
8 |
9 |
10 | import UIKit
11 |
12 | class FontsDesignViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
13 |
14 | var fontSize = 17.0
15 | // MARK: - Table Rows
16 |
17 | /// set font design by `UIFont.preferredFontDescriptor(withTextStyle:).withDesign
18 | lazy var rows: [UITableViewCell] = [
19 | buildCell(name: ".default", design: .default),
20 | buildCell(name: ".rounded", design: .rounded),
21 | buildCell(name: ".serif", design: .serif),
22 | buildCell(name: ".monospaced", design: .monospaced)
23 | ]
24 | // MARK: - UIViewController
25 |
26 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
27 | super.init(nibName: nil, bundle: nil)
28 |
29 | title = "Fonts Design"
30 | tabBarItem.image = UIImage(systemName: "textformat.abc")
31 | }
32 |
33 | required init?(coder: NSCoder) {
34 | fatalError("init(coder:) has not been implemented")
35 | }
36 |
37 | override func viewDidLoad() {
38 | super.viewDidLoad()
39 |
40 | view.addSubview(tableView)
41 | tableView.frame = view.bounds
42 | tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
43 | buildHeader()
44 | }
45 |
46 | // MARK: - Table View
47 |
48 | private lazy var tableView: UITableView = {
49 | let table = UITableView()
50 | table.dataSource = self
51 | table.delegate = self
52 | table.allowsSelection = false
53 | return table
54 | }()
55 |
56 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
57 | rows.count
58 | }
59 |
60 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
61 | rows[indexPath.row]
62 | }
63 | }
64 | extension FontsDesignViewController {
65 |
66 | @objc func increaseFontSize(_ sender: UIButton) {
67 | guard fontSize < 100 else {
68 | fontSize = 17.0
69 | return
70 | }
71 | fontSize += 1
72 | updateFontSizes()
73 | tableView.reloadData()
74 | }
75 |
76 | @objc func decreaseFontSize(_ sender: UIButton) {
77 | guard fontSize > 0 else {
78 | fontSize = 17.0
79 | return
80 | }
81 | fontSize -= 1
82 | updateFontSizes()
83 | tableView.reloadData()
84 | }
85 |
86 | private func updateFontSizes() {
87 | for cell in rows {
88 | cell.textLabel?.font = cell.textLabel?.font.withSize(fontSize)
89 |
90 | cell.detailTextLabel?.text = "Point Size: \(fontSize)"
91 | }
92 |
93 | tableView.reloadData()
94 | }
95 |
96 |
97 | private func buildHeader() {
98 | let headerView = UIView(frame: CGRect(x: 0, y: 0, width: view.frame.width, height: 50))
99 | headerView.backgroundColor = .systemGray6
100 |
101 | let label = UILabel(frame: CGRect(x: 10, y: 10, width: 100, height: 30))
102 | label.text = "Font Size"
103 | headerView.addSubview(label)
104 |
105 | let decreaseButton = UIButton(type: .system)
106 | decreaseButton.setTitle("-", for: .normal)
107 | decreaseButton.titleLabel?.font = UIFont.systemFont(ofSize: 25)
108 | decreaseButton.frame = CGRect(x: 130, y: 10, width: 30, height: 30)
109 | decreaseButton.addTarget(self, action: #selector(decreaseFontSize), for: .touchUpInside)
110 | headerView.addSubview(decreaseButton)
111 |
112 | let increaseButton = UIButton(type: .system)
113 | increaseButton.setTitle("+", for: .normal)
114 | increaseButton.titleLabel?.font = UIFont.systemFont(ofSize: 25)
115 | increaseButton.frame = CGRect(x: 170, y: 10, width: 30, height: 30)
116 | increaseButton.addTarget(self, action: #selector(increaseFontSize), for: .touchUpInside)
117 | headerView.addSubview(increaseButton)
118 |
119 | tableView.tableHeaderView = headerView
120 | }
121 |
122 | fileprivate func buildCell(name: String, design: UIFontDescriptor.SystemDesign) -> UITableViewCell {
123 | let cell = UITableViewCell(style: .subtitle, reuseIdentifier: nil)
124 |
125 | if let fontDescriptor = UIFontDescriptor.preferredFontDescriptor(withTextStyle: .body).withDesign(design) {
126 | let roundedFont = UIFont(descriptor: fontDescriptor, size: fontSize)
127 | cell.textLabel?.font = roundedFont
128 | cell.detailTextLabel?.text = "Point Size: \(roundedFont.pointSize)"
129 | }
130 | cell.textLabel?.text = name
131 |
132 | return cell
133 | }
134 | }
135 |
--------------------------------------------------------------------------------
/Semantic Colors/FontsViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // FontsViewController.swift
3 | // Semantic Colors
4 | //
5 | // Created by Aaron Brethorst on 10/29/19.
6 | // Copyright © 2019 Cocoa Controls. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | class FontsViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
12 |
13 | // MARK: - Table Rows
14 |
15 | /// Font text styles, semantic descriptions of the intended use for
16 | /// a font returned by `UIFont.preferredFont(forTextStyle:)`
17 | lazy var rows: [UITableViewCell] = [
18 | buildCell(name: ".largeTitle", font: UIFont.preferredFont(forTextStyle: .largeTitle)),
19 | buildCell(name: ".title1", font: UIFont.preferredFont(forTextStyle: .title1)),
20 | buildCell(name: ".title2", font: UIFont.preferredFont(forTextStyle: .title2)),
21 | buildCell(name: ".title3", font: UIFont.preferredFont(forTextStyle: .title3)),
22 | buildCell(name: ".headline", font: UIFont.preferredFont(forTextStyle: .headline)),
23 | buildCell(name: ".subheadline", font: UIFont.preferredFont(forTextStyle: .subheadline)),
24 | buildCell(name: ".body", font: UIFont.preferredFont(forTextStyle: .body)),
25 | buildCell(name: ".callout", font: UIFont.preferredFont(forTextStyle: .callout)),
26 | buildCell(name: ".footnote", font: UIFont.preferredFont(forTextStyle: .footnote)),
27 | buildCell(name: ".caption1", font: UIFont.preferredFont(forTextStyle: .caption1)),
28 | buildCell(name: ".caption2", font: UIFont.preferredFont(forTextStyle: .caption2)),
29 | ]
30 |
31 | // MARK: - UIViewController
32 |
33 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
34 | super.init(nibName: nil, bundle: nil)
35 |
36 | title = "Fonts"
37 | tabBarItem.image = UIImage(systemName: "textformat")
38 | }
39 |
40 | required init?(coder: NSCoder) {
41 | fatalError("init(coder:) has not been implemented")
42 | }
43 |
44 | override func viewDidLoad() {
45 | super.viewDidLoad()
46 |
47 | view.addSubview(tableView)
48 | tableView.frame = view.bounds
49 | tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
50 | }
51 |
52 | // MARK: - Table View
53 |
54 | private lazy var tableView: UITableView = {
55 | let table = UITableView()
56 | table.dataSource = self
57 | table.delegate = self
58 | table.allowsSelection = false
59 | return table
60 | }()
61 |
62 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
63 | rows.count
64 | }
65 |
66 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
67 | rows[indexPath.row]
68 | }
69 | }
70 |
71 | fileprivate func buildCell(name: String, font: UIFont) -> UITableViewCell {
72 | let cell = UITableViewCell(style: .subtitle, reuseIdentifier: nil)
73 |
74 | cell.textLabel?.font = font
75 | cell.textLabel?.text = name
76 | cell.detailTextLabel?.text = "Point Size: \(font.pointSize)"
77 |
78 | return cell
79 | }
80 |
--------------------------------------------------------------------------------
/Semantic Colors/Helpers.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Helpers.swift
3 | // Semantic Colors
4 | //
5 | // Created by Aaron Brethorst on 11/10/19.
6 | // Copyright © 2019 Cocoa Controls. All rights reserved.
7 | //
8 |
9 | import UIKit
10 |
11 | // MARK: - UIStackView
12 |
13 | extension UIStackView {
14 |
15 | /// Creates a stack view configured for displaying content vertically.
16 | /// - Parameter arrangedSubviews: The views to display within the returned stack view.
17 | public static func verticalStack(arrangedSubviews: [UIView]) -> UIStackView {
18 | let stack = UIStackView(arrangedSubviews: arrangedSubviews)
19 | stack.axis = .vertical
20 | stack.spacing = UIView.defaultPadding
21 | stack.translatesAutoresizingMaskIntoConstraints = false
22 | return stack
23 | }
24 | }
25 |
26 | // MARK: - UIView
27 |
28 | extension UIView {
29 |
30 | public static let defaultCornerRadius: CGFloat = 8.0
31 |
32 | public static let defaultPadding: CGFloat = 10.0
33 |
34 | public static let defaultDirectionalLayoutMargins = NSDirectionalEdgeInsets(top: defaultPadding, leading: defaultPadding, bottom: defaultPadding, trailing: defaultPadding)
35 |
36 | /// Creates a new instance of the receiver class, configured for use with Auto Layout.
37 | /// - Returns: An instance of the receiver class.
38 | public static func autolayoutNew() -> Self {
39 | let view = self.init(frame: .zero)
40 | view.translatesAutoresizingMaskIntoConstraints = false
41 | return view
42 | }
43 |
44 | func pinToSuperviewEdges() {
45 | guard let superview = superview else { return }
46 | NSLayoutConstraint.activate([
47 | topAnchor.constraint(equalTo: superview.topAnchor),
48 | leadingAnchor.constraint(equalTo: superview.leadingAnchor),
49 | trailingAnchor.constraint(equalTo: superview.trailingAnchor),
50 | bottomAnchor.constraint(equalTo: superview.bottomAnchor)
51 | ])
52 | }
53 |
54 | func pinToSuperviewLayoutMargins() {
55 | guard let superview = superview else { return }
56 | NSLayoutConstraint.activate([
57 | topAnchor.constraint(equalTo: superview.layoutMarginsGuide.topAnchor),
58 | leadingAnchor.constraint(equalTo: superview.layoutMarginsGuide.leadingAnchor),
59 | trailingAnchor.constraint(equalTo: superview.layoutMarginsGuide.trailingAnchor),
60 | bottomAnchor.constraint(equalTo: superview.layoutMarginsGuide.bottomAnchor)
61 | ])
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/Semantic Colors/IconsViewController.swift:
--------------------------------------------------------------------------------
1 | //
2 | // IconsViewController.swift
3 | // Semantic Colors
4 | //
5 | // Created by Aaron Brethorst on 11/8/19.
6 | // Copyright © 2019 Cocoa Controls. All rights reserved.
7 | //
8 |
9 | import UIKit
10 | import SFSymbols
11 |
12 | class IconsViewController: UIViewController, UISearchBarDelegate, UISearchResultsUpdating {
13 |
14 | // MARK: - Icons
15 |
16 | private let cellIdentifier = "identifier"
17 |
18 | private lazy var dataSource = IconDataSource(cellIdentifier: cellIdentifier)
19 |
20 | private lazy var searchDataSource = IconSearchDataSource(cellIdentifier: cellIdentifier)
21 |
22 | // MARK: - UIViewController
23 |
24 | override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
25 | super.init(nibName: nil, bundle: nil)
26 |
27 | title = "Icons"
28 | tabBarItem.image = UIImage(systemName: SFSymbol.eyeglasses.id)
29 | }
30 |
31 | required init?(coder: NSCoder) {
32 | fatalError("init(coder:) has not been implemented")
33 | }
34 |
35 | override func viewDidLoad() {
36 | super.viewDidLoad()
37 |
38 | tableView.register(UITableViewCell.self, forCellReuseIdentifier: cellIdentifier)
39 |
40 | view.addSubview(tableView)
41 | tableView.frame = view.bounds
42 | tableView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
43 |
44 | configureSearch()
45 | }
46 |
47 | override func viewDidAppear(_ animated: Bool) {
48 | super.viewDidAppear(animated)
49 |
50 | NotificationCenter.default.addObserver(self, selector: #selector(willShowKeyboard(note:)), name: UIResponder.keyboardWillShowNotification, object: nil)
51 | NotificationCenter.default.addObserver(self, selector: #selector(willHideKeyboard(note:)), name: UIResponder.keyboardWillHideNotification, object: nil)
52 | }
53 |
54 | override func viewDidDisappear(_ animated: Bool) {
55 | super.viewDidAppear(animated)
56 |
57 | NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil)
58 | NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil)
59 | }
60 |
61 | // MARK: - Table View
62 |
63 | private lazy var tableView: UITableView = {
64 | let table = UITableView()
65 | table.dataSource = dataSource
66 | table.delegate = dataSource
67 | table.allowsSelection = false
68 | return table
69 | }()
70 |
71 | // MARK: - Keyboard
72 |
73 | @objc private func willShowKeyboard(note: Notification) {
74 | guard
75 | let userInfo = note.userInfo,
76 | let frame = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue
77 | else {
78 | return
79 | }
80 |
81 | var insets = tableView.contentInset
82 | insets.bottom = frame.cgRectValue.height - view.safeAreaInsets.bottom
83 |
84 | tableView.contentInset = insets
85 | tableView.scrollIndicatorInsets = insets
86 | }
87 |
88 | @objc private func willHideKeyboard(note: Notification) {
89 | var insets = tableView.contentInset
90 | insets.bottom = .zero
91 |
92 | tableView.contentInset = insets
93 | tableView.scrollIndicatorInsets = insets
94 | }
95 |
96 | // MARK: - Search
97 |
98 | private let searchController = UISearchController(searchResultsController: nil)
99 |
100 | private func configureSearch() {
101 | searchController.searchResultsUpdater = self
102 | searchController.obscuresBackgroundDuringPresentation = false
103 | navigationItem.searchController = searchController
104 | definesPresentationContext = true
105 | searchController.searchBar.delegate = self
106 | }
107 |
108 | func updateSearchResults(for searchController: UISearchController) {
109 | if let text = searchController.searchBar.text {
110 | searchDataSource.filter(text: text)
111 | tableView.reloadData()
112 | }
113 | }
114 |
115 | func searchBarShouldBeginEditing(_ searchBar: UISearchBar) -> Bool {
116 | tableView.dataSource = searchDataSource
117 | tableView.delegate = searchDataSource
118 | tableView.reloadData()
119 |
120 | return true
121 | }
122 |
123 | func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
124 | tableView.dataSource = dataSource
125 | tableView.delegate = dataSource
126 | tableView.reloadData()
127 | }
128 | }
129 |
130 | // MARK: - IconDataSource
131 |
132 | /// A table view data source object that includes support for alphabetical section titles and a section index.
133 | fileprivate class IconDataSource: NSObject, UITableViewDataSource, UITableViewDelegate {
134 | private let cellIdentifier: String
135 |
136 | private let collation: UILocalizedIndexedCollation
137 | private var sections: [[String]]
138 |
139 | init(cellIdentifier: String) {
140 | self.cellIdentifier = cellIdentifier
141 | self.collation = UILocalizedIndexedCollation.current()
142 | self.sections = Array<[String]>(repeating: [], count: collation.sectionTitles.count)
143 |
144 | super.init()
145 |
146 | let icons = SFSymbol.allSymbols.map { $0.id }
147 | let selector = #selector(getter: description)
148 |
149 | let sortedObjects = collation.sortedArray(from: icons, collationStringSelector: selector) as! [String]
150 | for object in sortedObjects {
151 | let sectionNumber = collation.section(for: object, collationStringSelector: selector)
152 | sections[sectionNumber].append(object)
153 | }
154 | }
155 |
156 | func numberOfSections(in tableView: UITableView) -> Int {
157 | sections.count
158 | }
159 |
160 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
161 | sections[section].count
162 | }
163 |
164 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
165 | let iconName = sections[indexPath.section][indexPath.row]
166 |
167 | let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath)
168 | cell.imageView?.image = UIImage(systemName: iconName)
169 | cell.textLabel?.text = iconName
170 |
171 | return cell
172 | }
173 |
174 | func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
175 | collation.sectionTitles[section]
176 | }
177 |
178 | func sectionIndexTitles(for tableView: UITableView) -> [String]? {
179 | collation.sectionIndexTitles
180 | }
181 |
182 | func tableView(_ tableView: UITableView, sectionForSectionIndexTitle title: String, at index: Int) -> Int {
183 | collation.section(forSectionIndexTitle: index)
184 | }
185 | }
186 |
187 | // MARK: - IconSearchDataSource
188 |
189 | /// A table view data source that includes support for searching.
190 | fileprivate class IconSearchDataSource: NSObject, UITableViewDataSource, UITableViewDelegate {
191 |
192 | private let cellIdentifier: String
193 |
194 | init(cellIdentifier: String) {
195 | self.cellIdentifier = cellIdentifier
196 | }
197 |
198 | private lazy var allIcons = SFSymbol.allSymbols.map { $0.id }.sorted()
199 |
200 | var filteredIcons = [String]()
201 |
202 | func filter(text: String) {
203 | let searchText = text.trimmingCharacters(in: .whitespacesAndNewlines)
204 | filteredIcons = allIcons.filter { $0.localizedCaseInsensitiveContains(searchText) }
205 | }
206 |
207 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
208 | filteredIcons.count
209 | }
210 |
211 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
212 | let iconName = filteredIcons[indexPath.row]
213 |
214 | let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath)
215 | cell.imageView?.image = UIImage(systemName: iconName)
216 | cell.textLabel?.text = iconName
217 |
218 | return cell
219 | }
220 | }
221 |
--------------------------------------------------------------------------------
/Semantic Colors/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | $(PRODUCT_NAME)
15 | CFBundlePackageType
16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE)
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleVersion
20 | 1
21 | LSRequiresIPhoneOS
22 |
23 | UIApplicationSceneManifest
24 |
25 | UIApplicationSupportsMultipleScenes
26 |
27 | UISceneConfigurations
28 |
29 | UIWindowSceneSessionRoleApplication
30 |
31 |
32 | UISceneConfigurationName
33 | Default Configuration
34 | UISceneDelegateClassName
35 | $(PRODUCT_MODULE_NAME).SceneDelegate
36 |
37 |
38 |
39 |
40 | UILaunchStoryboardName
41 | LaunchScreen
42 | UIRequiredDeviceCapabilities
43 |
44 | armv7
45 |
46 | UISupportedInterfaceOrientations
47 |
48 | UIInterfaceOrientationPortrait
49 | UIInterfaceOrientationLandscapeLeft
50 | UIInterfaceOrientationLandscapeRight
51 |
52 | UISupportedInterfaceOrientations~ipad
53 |
54 | UIInterfaceOrientationPortrait
55 | UIInterfaceOrientationPortraitUpsideDown
56 | UIInterfaceOrientationLandscapeLeft
57 | UIInterfaceOrientationLandscapeRight
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/Semantic Colors/SwiftUIColorsView.swift:
--------------------------------------------------------------------------------
1 | //
2 | // SwiftUIColorsView.swift
3 | // Semantic Colors
4 | //
5 | // Created by Aaron Brethorst on 6/28/23.
6 | // Copyright © 2023 Cocoa Controls. All rights reserved.
7 | //
8 |
9 | import SwiftUI
10 |
11 | struct SwiftUIColorsView: View {
12 | static var hostingController: UIHostingController {
13 | let hostingController = UIHostingController(rootView: SwiftUIColorsView())
14 | hostingController.title = "SwiftUI Colors"
15 | hostingController.tabBarItem.image = UIImage(systemName: "swatchpalette")
16 | return hostingController
17 | }
18 |
19 | let colors: [(String, Color)] = [
20 | (".accentColor", .accentColor),
21 | (".red", .red),
22 | (".orange", .orange),
23 | (".yellow", .yellow),
24 | (".green", .green),
25 | (".mint", .mint),
26 | (".teal", .teal),
27 | (".cyan", .cyan),
28 | (".blue", .blue),
29 | (".indigo", .indigo),
30 | (".purple", .purple),
31 | (".pink", .pink),
32 | (".brown", .brown),
33 | (".white", .white),
34 | (".gray", .gray),
35 | (".black", .black),
36 | (".clear", .clear),
37 | (".primary", .primary),
38 | (".secondary", .secondary)
39 | ]
40 |
41 | func textColor(for color: Color) -> Color {
42 | if color == .white || color == .clear {
43 | return .black
44 | }
45 | else {
46 | return .white
47 | }
48 | }
49 |
50 | var body: some View {
51 | List {
52 | ForEach(colors, id: \.1) { name, c in
53 | ZStack {
54 | Rectangle().fill(c)
55 | Text(name)
56 | .foregroundColor(textColor(for: c))
57 | }
58 | .listRowSeparator(.hidden)
59 | }
60 | }
61 | .listStyle(.plain)
62 | }
63 | }
64 |
65 | struct SwiftUIColorsView_Previews: PreviewProvider {
66 | static var previews: some View {
67 | NavigationStack {
68 | SwiftUIColorsView()
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------