Skip to content

Commit

Permalink
Refactor Typography and ButtonStyles like SwiftUI 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Jul 20, 2022
1 parent 8025f4a commit 06d252a
Show file tree
Hide file tree
Showing 39 changed files with 763 additions and 426 deletions.
4 changes: 2 additions & 2 deletions Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1179,7 +1179,7 @@
DEVELOPMENT_TEAM = ER582ZK85C;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1201,7 +1201,7 @@
DEVELOPMENT_TEAM = ER582ZK85C;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = iOS/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"colors" : [
{
"color" : {
"platform" : "osx",
"reference" : "systemBlueColor"
},
"idiom" : "universal"
}
],
Expand Down
3 changes: 2 additions & 1 deletion Example/Shared/ComponentsList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ struct ComponentsList: View {
ForEach(pages) { page in
HStack {
NavigationLink(page.name, destination: page.page)
.fontStyle(.button, color: .onSurfaceHighEmphasis)
.body(true)
.foregroundColor(.onSurfaceHighEmphasis)

Spacer()
}
Expand Down
55 changes: 45 additions & 10 deletions Example/Shared/DemoPages/ButtonsDemo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,63 @@ struct ButtonsDemo: View {
ScrollView {
VStack(spacing: .xSmall) {
Button("Button") { print(#function) }
.style(.primary)
.buttonStyle(.primary)
.elevation(.z2)

Button("Button") { print(#function) }
.style(.primary)
.buttonStyle(.secondary)
.elevation(.z2)

Button("Button") { print(#function) }
.style(.secondary)
.buttonStyle(.tertiary)

Button("Button") { print(#function) }
.style(.gray)
.buttonStyle(.quaternary)

Button("Button") { print(#function) }
.style(.text)
.accent()
.buttonStyle(.primary)
.controlRadius(.xLarge)

Button("Button") { print(#function) }
.style(.link)
.buttonStyle(.quaternary)
.accent()

Button("Button") { print(#function) }
.style(.deleteLink)
Button(role: .cancel) {
print(#function)
} label: {
Text("Button")
}
.buttonStyle(.primary)

Button("Button") { print(#function) }
.style(.secondary, size: .medium, rounded: .full, width: .full, shadow: true)
Button(role: .destructive) {
print(#function)
} label: {
Text("Button")
}
.buttonStyle(.primary)

HStack {
Button("Button") { print(#function) }
.buttonStyle(.secondary)
.accent()
.controlSize(.small)
.elevation(.z2)

Button("Button") { print(#function) }
.buttonStyle(.secondary)
.controlSize(.mini)
.elevation(.z2)

Button {
print(#function)
} label: {
Image(systemName: "archivebox")
}
.controlSize(.small)
.buttonStyle(.secondary)
.elevation(.z2)
}

}.padding()
}
Expand Down
2 changes: 1 addition & 1 deletion Example/Shared/DemoPages/SegmentedControlDemo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct SegmentedControlDemo: View {
.padding(.xxSmall)
Text(item)
Text("Subtitle")
.fontStyle(.subtitle2, color: .onSurfaceMediumEmphasis)
.fontStyle(.subheadline, color: .onSurfaceMediumEmphasis)
}
}
.segmentedControlStyle(SelectionOnlySegmentedControlStyle())
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.5
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.
// swiftlint:disable all

Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OversizeUI

![Build Status](https://github.com/aromanov91/oversizeUI/actions/workflows/buildExampleIOS.yml/badge.svg)
![Build Status](https://github.com/oversizedev/oversizeUI/actions/workflows/buildExampleIOS.yml/badge.svg)
![GitHub](https://img.shields.io/github/license/aromanov91/oversizeUI)

Yet another component library on SwiftUI
Expand Down Expand Up @@ -33,14 +33,14 @@ Colors, Typography, Spacing and other styles in [core folder](Sources/OversizeUI
### Install and use OversizeUI

#### Requirements
- iOS 14+ or macOS 11.0+
- Xcode 13.2+
- Swift 5.5+
- iOS 15+ or macOS 12.0+
- Xcode 13.4+
- Swift 5.6+

#### Swift Package Manager
- File > Swift Packages > Add Package Dependency
- Add `https://github.com/aromanov91/oversizeUI.git`
- Select "Up to Next Major" with "1.5.2"
- Add `https://github.com/oversizedev/OversizeUI.git`
- Select "Up to Next Major" with "2.0.0"

### Import and use OversizeUI
After the framework has been added you can import the module to use it:
Expand All @@ -67,12 +67,10 @@ AvatarView(firstName: "Jhon", size: .small)
### Buttons
```swift
Button("Button") { print(#function) }
.style(.primary)
```

```swift
Button("Button") { print(#function) }
.style(.secondary, size: .m, rounded: .full, width: .full, shadow: true)
.buttonStyle(.primary)
.accent()
.controlBorderShape(.capsule)
.bordered()
```

### Color selector
Expand Down
Loading

0 comments on commit 06d252a

Please sign in to comment.