Skip to content

Commit b59a49d

Browse files
authored
Merge pull request #20 from mtj0928/remove-slide-scale
remove slide scale
2 parents 693b07d + 4f5476b commit b59a49d

File tree

58 files changed

+101
-644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+101
-644
lines changed

SlideKitDemo-iOS/SlideKitDemo-iOS/Slides/BasicSlide.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct BasicSlide: Slide {
1616
Item("Piyo")
1717
}
1818
Item {
19-
SlideHStack(spacing: 16) {
19+
HStack {
2020
Text("Hoge")
2121
Circle()
2222
}

SlideKitDemo-iOS/SlideKitDemo-iOS/Slides/TitleSlide.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ struct TitleSlide: Slide {
1919
let title: String
2020

2121
var body: some View {
22-
SlideVStack {
22+
VStack {
2323
Text(title)
2424
if phasedStateStore.when(.double) {
2525
Text(title)
2626
}
2727
}
28-
.slideFontSize(50)
28+
.font(.system(size: 50))
2929
}
3030
}
3131

SlideKitDemo-macOS/SlideKitDemo-macOS/Slides/CustomHeaderStyleSlide.swift

+10-10
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,28 @@ struct CustomHeaderStyleSlide: Slide {
2626
struct CustomHeaderStyle: HeaderSlideStyle {
2727

2828
func makeBody(configuration: Configuration) -> some View {
29-
SlideVStack(alignment: .leading) {
29+
VStack(alignment: .leading) {
3030
configuration.header
31-
.slideFontSize(90)
31+
.font(.system(size: 90))
3232
.foregroundColor(.white)
33-
.slidePadding()
33+
.padding()
3434
.frame(maxWidth: .infinity, alignment: .leading)
3535
.background {
3636
Color.accentColor
3737
}
38-
SlideVStack(alignment: .leading, spacing: 48) {
38+
VStack(alignment: .leading, spacing: 48) {
3939
configuration.content
4040
}
41-
.slidePadding()
41+
.padding()
4242
}
4343
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading)
4444
}
4545
}
4646

4747
struct CustomItemStyle: ItemStyle {
4848
func makeBody(configuration: Configuration) -> some View {
49-
SlideVStack(alignment: .leading, spacing: 28) {
50-
SlideHStack(alignment: .firstTextBaseline, spacing: 10) {
49+
VStack(alignment: .leading, spacing: 28) {
50+
HStack(alignment: .firstTextBaseline, spacing: 10) {
5151
Group {
5252
switch configuration.accessory {
5353
case .bullet:
@@ -62,16 +62,16 @@ struct CustomItemStyle: ItemStyle {
6262
case nil: EmptyView()
6363
}
6464
}
65-
.slideFontSize(configuration.fontSize)
65+
.font(.system(size: configuration.fontSize))
6666

6767
configuration.label
68-
.slideFontSize(configuration.fontSize)
68+
.font(.system(size: configuration.fontSize))
6969
.fixedSize()
7070
}
7171

7272

7373
if let child = configuration.child {
74-
child.slidePadding(.leading, configuration.fontSize)
74+
child.padding(.leading, configuration.fontSize)
7575
}
7676
}
7777
}

Sources/SlideKit/EnvironmentValues/EnvironmentValues+ScreenSize.swift

-19
This file was deleted.

Sources/SlideKit/EnvironmentValues/EnvironmentValues+SlideScale.swift

-21
This file was deleted.

Sources/SlideKit/EnvironmentValues/EnvironmentValues+SlideSize.swift

-19
This file was deleted.

Sources/SlideKit/SlideComponents/Code.swift

+6-15
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,38 @@ import SwiftUI
1111

1212
public struct Code: View {
1313

14-
@Environment(\.slideScale)
15-
var scale
16-
1714
let code: String
1815
let colorTheme: CodeColorTheme
19-
let slideFontSize: CGFloat
20-
let lineSpacing: CGFloat
16+
let fontSize: CGFloat
2117

2218
public init(
2319
_ code: String,
2420
colorTheme: CodeColorTheme = .presentation,
25-
slideFontSize: CGFloat = 48,
26-
slideLineSpacing: CGFloat = 12
21+
fontSize: CGFloat = 48
2722
) {
2823
self.code = code
2924
self.colorTheme = colorTheme
30-
self.slideFontSize = slideFontSize
31-
self.lineSpacing = slideLineSpacing
25+
self.fontSize = fontSize
3226
}
3327

3428
public var body: some View {
35-
let fontSize = scale * slideFontSize
3629
let theme = colorTheme.buildTheme(with: Font(size: fontSize))
3730
let format = SlideCodeFormat(theme: theme)
3831
let highlighter = SyntaxHighlighter(format: format)
3932
let attributedString = highlighter.highlight(code)
4033
return Text(attributedString)
41-
.slideLineSpace(lineSpacing)
4234
}
4335
}
4436

4537
struct Code_Previews: PreviewProvider {
4638
static var previews: some View {
4739
SlidePreview {
4840
ViewSlide {
49-
ZStack {
50-
SwiftUI.Color(red: 42 / 255, green: 42 / 255, blue: 48 / 255)
51-
Code(code, colorTheme: .defaultDark)
52-
}
41+
Code(code, colorTheme: .defaultDark)
42+
.lineSpacing(12)
5343
}
5444
}
45+
.previewSlideBackgroundColor(SwiftUI.Color(red: 42 / 255, green: 42 / 255, blue: 48 / 255))
5546
}
5647

5748
private static var code: String {

Sources/SlideKit/SlideComponents/Item.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -36,52 +36,52 @@ public struct Item: View {
3636
private let accessory: ItemAccessory?
3737
private let label: () -> AnyView
3838
private let fontSize: CGFloat
39-
private let child: (() -> AnyView)?
39+
private let child: (() -> AnyView)?
4040

4141
public init(
4242
_ text: LocalizedStringKey,
43-
slideFontSize: CGFloat = 48,
43+
fontSize: CGFloat = 48,
4444
accessory: ItemAccessory? = .bullet,
4545
@ViewBuilder child: @escaping () -> some View
4646
) {
4747
self.label = { AnyView(Text(text)) }
4848
self.child = { AnyView(child()) }
4949
self.accessory = accessory
50-
self.fontSize = slideFontSize
50+
self.fontSize = fontSize
5151
}
5252

5353
public init(
5454
accessory: ItemAccessory? = .bullet,
55-
slideFontSize: CGFloat = 48,
55+
fontSize: CGFloat = 48,
5656
label: @escaping () -> some View,
5757
@ViewBuilder child: @escaping () -> some View
5858
) {
5959
self.label = { AnyView(label()) }
6060
self.child = { AnyView(child()) }
6161
self.accessory = accessory
62-
self.fontSize = slideFontSize
62+
self.fontSize = fontSize
6363
}
6464

6565
public init(
6666
_ text: String,
67-
slideFontSize: CGFloat = 48,
67+
fontSize: CGFloat = 48,
6868
accessory: ItemAccessory? = .bullet
6969
) {
7070
self.label = { AnyView(Text(text)) }
7171
self.child = nil
7272
self.accessory = accessory
73-
self.fontSize = slideFontSize
73+
self.fontSize = fontSize
7474
}
7575

7676
public init(
7777
accessory: ItemAccessory? = .bullet,
78-
slideFontSize: CGFloat = 48,
78+
fontSize: CGFloat = 48,
7979
label: @escaping () -> some View
8080
) {
8181
self.label = { AnyView(label()) }
8282
self.child = { AnyView(EmptyView()) }
8383
self.accessory = accessory
84-
self.fontSize = slideFontSize
84+
self.fontSize = fontSize
8585
}
8686

8787
public var body: some View {

Sources/SlideKit/SlideComponents/ItemStyle.swift

+7-7
Original file line numberDiff line numberDiff line change
@@ -71,31 +71,31 @@ struct AnyItemStyle: ItemStyle {
7171

7272
public struct DefaultItemStyle: ItemStyle {
7373
public func makeBody(configuration: Configuration) -> some View {
74-
SlideVStack(alignment: .leading, spacing: 28) {
75-
SlideHStack(alignment: .firstTextBaseline, spacing: configuration.fontSize * 0.5) {
74+
VStack(alignment: .leading, spacing: 28) {
75+
HStack(alignment: .firstTextBaseline, spacing: configuration.fontSize * 0.5) {
7676
Group {
7777
switch configuration.accessory {
7878
case .bullet:
7979
Circle()
80-
.slideFrame(width: configuration.fontSize * 20 / 48, height: configuration.fontSize * 20 / 48)
80+
.frame(width: configuration.fontSize * 20 / 48, height: configuration.fontSize * 20 / 48)
8181
.aspectRatio(1.0, contentMode: .fill)
82-
.slideOffset(y: -configuration.fontSize / 5)
82+
.offset(y: -configuration.fontSize / 5)
8383
case .string(let text):
8484
Text("\(text).")
8585
case .number(let number):
8686
Text("\(number).")
8787
case nil: EmptyView()
8888
}
8989
}
90-
.slideFontSize(configuration.fontSize)
90+
.font(.system(size: configuration.fontSize))
9191

9292
configuration.label
93-
.slideFontSize(configuration.fontSize)
93+
.font(.system(size: configuration.fontSize))
9494
.fixedSize()
9595
}
9696

9797
if let child = configuration.child {
98-
child.slidePadding(.leading, configuration.fontSize)
98+
child.padding(.leading, configuration.fontSize)
9999
}
100100
}
101101
}

Sources/SlideKit/SlideComponents/SlideStack.swift

-48
This file was deleted.

Sources/SlideKit/SlideComponents/Templates/HeaderSlideStyle.swift

+8-8
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,23 @@ struct AnyHeaderSlideStyle: HeaderSlideStyle {
8181

8282
public struct DefaultHeaderSlideStyle: HeaderSlideStyle {
8383
public func makeBody(configuration: Configuration) -> some View {
84-
SlideVStack(alignment: .leading, spacing: .zero) {
85-
SlideVStack(alignment: .leading, spacing: 80) {
86-
SlideHStack(spacing: 32) {
84+
VStack(alignment: .leading, spacing: .zero) {
85+
VStack(alignment: .leading, spacing: 80) {
86+
HStack(spacing: 32) {
8787
Capsule()
8888
.foregroundColor(.accentColor)
89-
.slideFrame(width: 10, height: 120)
89+
.frame(width: 10, height: 120)
9090
configuration.header
91-
.slideFontSize(90)
91+
.font(.system(size: 90))
9292
.frame(maxWidth: .infinity, alignment: .leading)
9393
}
94-
SlideVStack(alignment: .leading, spacing: 48) {
94+
VStack(alignment: .leading, spacing: 48) {
9595
configuration.content
96-
.slideFontSize(48)
96+
.font(.system(size: 48))
9797
}
9898
}
9999
Spacer(minLength: 0)
100100
}
101-
.slidePadding(60)
101+
.padding(60)
102102
}
103103
}

0 commit comments

Comments
 (0)