Skip to content

Commit

Permalink
#43 Use element-design-tokens repo.
Browse files Browse the repository at this point in the history
Remove vc_ and unnecessary selfs.
  • Loading branch information
pixlwave committed May 20, 2022
1 parent 5218705 commit 4aa03f5
Show file tree
Hide file tree
Showing 46 changed files with 87 additions and 1,353 deletions.
12 changes: 9 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ xcuserdata/
*.dSYM.zip
*.dSYM

## SwiftPM
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
Expand All @@ -27,6 +36,3 @@ Tools/Scripts/element-android
## macOS Files
.DS_Store
._*

## Node.js
node_modules/
1 change: 1 addition & 0 deletions DesignKit/Sources/Buttons/PrimaryActionButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//

import SwiftUI
import DesignTokens

public struct PrimaryActionButtonStyle: ButtonStyle {
@Environment(\.isEnabled) private var isEnabled
Expand Down
1 change: 1 addition & 0 deletions DesignKit/Sources/Buttons/SecondaryActionButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//

import SwiftUI
import DesignTokens

public struct SecondaryActionButtonStyle: ButtonStyle {
@Environment(\.isEnabled) private var isEnabled
Expand Down
18 changes: 9 additions & 9 deletions DesignKit/Sources/Fonts/ElementFonts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extension ElementFonts {
}

public var largeTitleB: SharedFont {
let uiFont = largeTitle.uiFont.vc_bold
let uiFont = largeTitle.uiFont.bold
return SharedFont(uiFont: uiFont, font: .largeTitle.bold())
}

Expand All @@ -72,7 +72,7 @@ extension ElementFonts {
}

public var title1B: SharedFont {
let uiFont = title1.uiFont.vc_bold
let uiFont = title1.uiFont.bold
return SharedFont(uiFont: uiFont, font: .title.bold())
}

Expand All @@ -82,7 +82,7 @@ extension ElementFonts {
}

public var title2B: SharedFont {
let uiFont = title2.uiFont.vc_bold
let uiFont = title2.uiFont.bold
return SharedFont(uiFont: uiFont, font: .title2.bold())
}

Expand All @@ -92,7 +92,7 @@ extension ElementFonts {
}

public var title3SB: SharedFont {
let uiFont = title3.uiFont.vc_semiBold
let uiFont = title3.uiFont.semiBold
return SharedFont(uiFont: uiFont, font: .title3.weight(.semibold))
}

Expand All @@ -112,7 +112,7 @@ extension ElementFonts {
}

public var bodySB: SharedFont {
let uiFont = body.uiFont.vc_semiBold
let uiFont = body.uiFont.semiBold
return SharedFont(uiFont: uiFont, font: .body.weight(.semibold))
}

Expand All @@ -122,7 +122,7 @@ extension ElementFonts {
}

public var calloutSB: SharedFont {
let uiFont = callout.uiFont.vc_semiBold
let uiFont = callout.uiFont.semiBold
return SharedFont(uiFont: uiFont, font: .callout.weight(.semibold))
}

Expand All @@ -132,7 +132,7 @@ extension ElementFonts {
}

public var footnoteSB: SharedFont {
let uiFont = footnote.uiFont.vc_semiBold
let uiFont = footnote.uiFont.semiBold
return SharedFont(uiFont: uiFont, font: .footnote.weight(.semibold))
}

Expand All @@ -142,7 +142,7 @@ extension ElementFonts {
}

public var caption1SB: SharedFont {
let uiFont = caption1.uiFont.vc_semiBold
let uiFont = caption1.uiFont.semiBold
return SharedFont(uiFont: uiFont, font: .caption.weight(.semibold))
}

Expand All @@ -152,7 +152,7 @@ extension ElementFonts {
}

public var caption2SB: SharedFont {
let uiFont = caption2.uiFont.vc_semiBold
let uiFont = caption2.uiFont.semiBold
return SharedFont(uiFont: uiFont, font: .caption2.weight(.semibold))
}
}
42 changes: 21 additions & 21 deletions DesignKit/Sources/Fonts/ElementFontsSwiftUI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,27 @@ public struct ElementFontsSwiftUI {
public var caption2SB: Font

public init(values: ElementFonts) {
self.uiFonts = ElementFontsUIKit(values: values)
uiFonts = ElementFontsUIKit(values: values)

self.largeTitle = values.largeTitle.font
self.largeTitleB = values.largeTitleB.font
self.title1 = values.title1.font
self.title1B = values.title1B.font
self.title2 = values.title2.font
self.title2B = values.title2B.font
self.title3 = values.title3.font
self.title3SB = values.title3SB.font
self.headline = values.headline.font
self.subheadline = values.subheadline.font
self.body = values.body.font
self.bodySB = values.bodySB.font
self.callout = values.callout.font
self.calloutSB = values.calloutSB.font
self.footnote = values.footnote.font
self.footnoteSB = values.footnoteSB.font
self.caption1 = values.caption1.font
self.caption1SB = values.caption1SB.font
self.caption2 = values.caption2.font
self.caption2SB = values.caption2SB.font
largeTitle = values.largeTitle.font
largeTitleB = values.largeTitleB.font
title1 = values.title1.font
title1B = values.title1B.font
title2 = values.title2.font
title2B = values.title2B.font
title3 = values.title3.font
title3SB = values.title3SB.font
headline = values.headline.font
subheadline = values.subheadline.font
body = values.body.font
bodySB = values.bodySB.font
callout = values.callout.font
calloutSB = values.calloutSB.font
footnote = values.footnote.font
footnoteSB = values.footnoteSB.font
caption1 = values.caption1.font
caption1SB = values.caption1SB.font
caption2 = values.caption2.font
caption2SB = values.caption2SB.font
}
}
40 changes: 20 additions & 20 deletions DesignKit/Sources/Fonts/ElementFontsUIKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,25 @@ import UIKit
public var caption2SB: UIFont

public init(values: ElementFonts) {
self.largeTitle = values.largeTitle.uiFont
self.largeTitleB = values.largeTitleB.uiFont
self.title1 = values.title1.uiFont
self.title1B = values.title1B.uiFont
self.title2 = values.title2.uiFont
self.title2B = values.title2B.uiFont
self.title3 = values.title3.uiFont
self.title3SB = values.title3SB.uiFont
self.headline = values.headline.uiFont
self.subheadline = values.subheadline.uiFont
self.body = values.body.uiFont
self.bodySB = values.bodySB.uiFont
self.callout = values.callout.uiFont
self.calloutSB = values.calloutSB.uiFont
self.footnote = values.footnote.uiFont
self.footnoteSB = values.footnoteSB.uiFont
self.caption1 = values.caption1.uiFont
self.caption1SB = values.caption1SB.uiFont
self.caption2 = values.caption2.uiFont
self.caption2SB = values.caption2SB.uiFont
largeTitle = values.largeTitle.uiFont
largeTitleB = values.largeTitleB.uiFont
title1 = values.title1.uiFont
title1B = values.title1B.uiFont
title2 = values.title2.uiFont
title2B = values.title2B.uiFont
title3 = values.title3.uiFont
title3SB = values.title3SB.uiFont
headline = values.headline.uiFont
subheadline = values.subheadline.uiFont
body = values.body.uiFont
bodySB = values.bodySB.uiFont
callout = values.callout.uiFont
calloutSB = values.calloutSB.uiFont
footnote = values.footnote.uiFont
footnoteSB = values.footnoteSB.uiFont
caption1 = values.caption1.uiFont
caption1SB = values.caption1SB.uiFont
caption2 = values.caption2.uiFont
caption2SB = values.caption2SB.uiFont
}
}
16 changes: 8 additions & 8 deletions DesignKit/Sources/Fonts/UIFont.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public extension UIFont {
// MARK: - Convenient methods

/// Update current font with a SymbolicTraits
func vc_withTraits(_ traits: UIFontDescriptor.SymbolicTraits) -> UIFont {
func withTraits(_ traits: UIFontDescriptor.SymbolicTraits) -> UIFont {
guard let descriptor = fontDescriptor.withSymbolicTraits(traits) else {
return self
}
Expand All @@ -31,7 +31,7 @@ public extension UIFont {
}

/// Update current font with a given Weight
func vc_withWeight(weight: Weight) -> UIFont {
func withWeight(weight: Weight) -> UIFont {
// Add the font weight to the descriptor
let weightedFontDescriptor = fontDescriptor.addingAttributes([
UIFontDescriptor.AttributeName.traits: [
Expand All @@ -43,15 +43,15 @@ public extension UIFont {

// MARK: - Shortcuts

var vc_bold: UIFont {
return vc_withTraits(.traitBold)
var bold: UIFont {
return withTraits(.traitBold)
}

var vc_semiBold: UIFont {
return vc_withWeight(weight: .semibold)
var semiBold: UIFont {
return withWeight(weight: .semibold)
}

var vc_italic: UIFont {
return vc_withTraits(.traitItalic)
var italic: UIFont {
return withTraits(.traitItalic)
}
}
2 changes: 1 addition & 1 deletion DesignKit/Sources/TextFields/BorderedInputFieldStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
// limitations under the License.
//

import Foundation
import SwiftUI
import DesignTokens
import Introspect

/// A bordered style of text input
Expand Down
1 change: 0 additions & 1 deletion DesignKit/Sources/TextFields/RoundedCornerShape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// limitations under the License.
//

import Foundation
import SwiftUI

@available(iOS 14.0, *)
Expand Down
65 changes: 0 additions & 65 deletions DesignKit/StyleDictionary/ElementColors.swift

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 4aa03f5

Please sign in to comment.