Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/restructure #47

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Ruby 3.3.0
- name: Setup Ruby 3.3.6
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.0'
ruby-version: '3.3.6'
bundler-cache: true

- name: Netrc maven.pkg.github.com
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Ruby 3.3.0
- name: Setup Ruby 3.3.6
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3.0'
ruby-version: '3.3.6'
bundler-cache: true

- name: Netrc api.github.com
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.1
3.3.6
8 changes: 8 additions & 0 deletions Modules/SharedUI/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1540"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SharedUI"
BuildableName = "SharedUI"
BlueprintName = "SharedUI"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "SharedUI"
BuildableName = "SharedUI"
BlueprintName = "SharedUI"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
28 changes: 28 additions & 0 deletions Modules/SharedUI/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version: 5.9

import PackageDescription

let package = Package(
name: "SharedUI",
platforms: [
.iOS(.v15),
],
products: [
.library(
name: "SharedUI",
targets: ["SharedUI"]
),
],
targets: [
.target(
name: "SharedUI",
resources: [
.process("Resources"),
]
),
.testTarget(
name: "SharedUITests",
dependencies: ["SharedUI"]
),
]
)
33 changes: 33 additions & 0 deletions Modules/SharedUI/Sources/SharedUI/Colors.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import SwiftUI

public extension Color {
static var main: Color {
Color(.main)
}

static var accent: Color {
Color(.accent)
}

/// black in light mode, white in dark mode
static var blackWhite: Color {
Color(.blackWhite)
}

/// white in light mode, black in dark mode
static var whiteBlack: Color {
Color(.whiteBlack)
}

static var text: Color {
Color(.text)
}

static var title: Color {
Color(.title)
}

static var palletOrange: Color {
Color(.palletOrange)
}
}
87 changes: 87 additions & 0 deletions Modules/SharedUI/Sources/SharedUI/Fonts.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import SwiftUI

public enum WrFont {
case h1
case h2
case h3
case h4
case body
case caption1
case caption2

var baseSize: CGFloat {
switch self {
case .h1:
56
case .h2:
48
case .h3:
32
case .h4:
24
case .body:
18
case .caption1:
14
case .caption2:
12
}
}
}

private struct WrTextStyle: ViewModifier {
let fontStyle: WrFont
let textColor: Color

@ScaledMetric
var fontSize: CGFloat

var font: Font {
.system(size: fontSize)
}

init(fontStyle: WrFont, textColor: Color) {
self.fontStyle = fontStyle
self.textColor = textColor
_fontSize = ScaledMetric(wrappedValue: fontStyle.baseSize)
}

func body(content: Content) -> some View {
content
.font(font)
.foregroundStyle(textColor)
}
}

public extension View {
func textStyle(_ font: WrFont, textColor: Color = .text) -> some View {
modifier(WrTextStyle(fontStyle: font, textColor: textColor))
}
}

#Preview {
ScrollView {
VStack {
Text("h1")
.textStyle(.h1)

Text("h2")
.textStyle(.h2)

Text("h3")
.textStyle(.h3)

Text("h4")
.textStyle(.h4)

Text("body")
.textStyle(.body)

Text("caption1")
.textStyle(.caption1)

Text("caption2")
.textStyle(.caption2)
}
}
}
11 changes: 11 additions & 0 deletions Modules/SharedUI/Sources/SharedUI/Images.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import SwiftUI

public extension Image {
static var logoRounded: Image {
Image(.logoRounded)
}

static var logoLaunch: Image {
Image(.logoLaunch)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "0.491",
"red" : "0.375"
"blue" : "0xFF",
"green" : "0x7D",
"red" : "0x60"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFF",
"green" : "0xBC",
"red" : "0xAC"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x88",
"green" : "0x4C",
"red" : "0x40"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"colors" : [
{
"color" : {
"color-space" : "display-p3",
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.967",
"green" : "0.691",
"red" : "0.607"
"blue" : "0x46",
"green" : "0x96",
"red" : "0xFA"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x47",
"green" : "0x23",
"red" : "0x1B"
}
},
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Loading