Skip to content

Commit

Permalink
chore: 🤖 code format updates (#664)
Browse files Browse the repository at this point in the history
* feat: 🎸 support 72 semibold style

* feat: 🎸 support 72 SemiboldDuplex font style

* chore: 🤖 minor updates

* chore: 🤖 check only view prop when determine component's empty state

* chore: 🤖 fix issue when running allPhasesNoCache.sh

* chore: 🤖 sourcery annotation supports default value

* chore: 🤖 sourcery supports generating internal component

* chore: 🤖 upgrade swiftformat version

* chore: 🤖 code format updates

* chore: 🤖 code format updates
  • Loading branch information
billzhou0223 authored Mar 14, 2024
1 parent 2ff2d40 commit 0099b37
Show file tree
Hide file tree
Showing 222 changed files with 1,898 additions and 1,813 deletions.
2 changes: 1 addition & 1 deletion Apps/Examples/Examples/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI
import UIKit

@UIApplicationMain
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
Expand Down
6 changes: 4 additions & 2 deletions Apps/Examples/Examples/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ struct ContentView: View {
Text("Charts")
}
NavigationLink(
destination: CoreContentView()) {
destination: CoreContentView())
{
Text("Core Elements")
}
NavigationLink(
destination: FioriThemeManagerContentView()) {
destination: FioriThemeManagerContentView())
{
Text("Theme Manager")
}
}
Expand Down
20 changes: 10 additions & 10 deletions Apps/Examples/Examples/FioriCharts/ChartDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ struct ChartDetailConfigView: View {
var body: some View {
GeometryReader { _ in
ChartView(self.model)
.ifApply(seriesShapeStyleEnable) {
.ifApply(self.seriesShapeStyleEnable) {
$0.chartSeriesShapeStyle([0: AnyShapeStyle(linearGradient)])
}
.ifApply(categoryShapeStyleEnable) {
.ifApply(self.categoryShapeStyleEnable) {
$0.chartCategoryShapeStyle([0: [0: AnyShapeStyle(linearGradient), 1: AnyShapeStyle(Color.yellow), 2: AnyShapeStyle(angularGradient)],
1: [3: AnyShapeStyle(radialGradient), 4: AnyShapeStyle(imagePaint)]])
}
Expand All @@ -33,8 +33,8 @@ struct ChartDetailConfigView: View {
self.showingSettings.toggle()
})
.navigationBarTitle("Detail", displayMode: .inline)
.sheet(isPresented: $showingSettings) {
Settings(seriesShapeStyleEnable: $seriesShapeStyleEnable, categoryShapeStyleEnable: $categoryShapeStyleEnable).environmentObject(self.model)
.sheet(isPresented: self.$showingSettings) {
Settings(seriesShapeStyleEnable: self.$seriesShapeStyleEnable, categoryShapeStyleEnable: self.$categoryShapeStyleEnable).environmentObject(self.model)
}
}
}
Expand Down Expand Up @@ -71,10 +71,10 @@ struct ChartDetailView: View {
VStack(alignment: .center, spacing: 0) {
HStack(alignment: .center) {
ChartView(self.model)
.ifApply(seriesShapeStyleEnable) {
.ifApply(self.seriesShapeStyleEnable) {
$0.chartSeriesShapeStyle([0: AnyShapeStyle(linearGradient)])
}
.ifApply(categoryShapeStyleEnable) {
.ifApply(self.categoryShapeStyleEnable) {
$0.chartCategoryShapeStyle([0: [0: AnyShapeStyle(linearGradient), 1: AnyShapeStyle(Color.yellow), 2: AnyShapeStyle(angularGradient)],
1: [3: AnyShapeStyle(radialGradient), 4: AnyShapeStyle(imagePaint)]])
}
Expand All @@ -85,18 +85,18 @@ struct ChartDetailView: View {
if !self.isFullScreen {
Divider().edgesIgnoringSafeArea(.all)

Settings(seriesShapeStyleEnable: $seriesShapeStyleEnable, categoryShapeStyleEnable: $categoryShapeStyleEnable).environmentObject(self.model)
Settings(seriesShapeStyleEnable: self.$seriesShapeStyleEnable, categoryShapeStyleEnable: self.$categoryShapeStyleEnable).environmentObject(self.model)
}
}
}
} else { // Landscape mode
HStack(spacing: 0) {
ZStack(alignment: .topLeading) {
ChartView(self.model)
.ifApply(seriesShapeStyleEnable) {
.ifApply(self.seriesShapeStyleEnable) {
$0.chartSeriesShapeStyle([0: AnyShapeStyle(linearGradient)])
}
.ifApply(categoryShapeStyleEnable) {
.ifApply(self.categoryShapeStyleEnable) {
$0.chartCategoryShapeStyle([0: [0: AnyShapeStyle(linearGradient), 1: AnyShapeStyle(Color.yellow), 2: AnyShapeStyle(angularGradient)],
1: [3: AnyShapeStyle(radialGradient), 4: AnyShapeStyle(imagePaint)]])
}
Expand All @@ -114,7 +114,7 @@ struct ChartDetailView: View {
if !self.isFullScreen {
Divider().edgesIgnoringSafeArea(.all)

Settings(seriesShapeStyleEnable: $seriesShapeStyleEnable, categoryShapeStyleEnable: $categoryShapeStyleEnable).environmentObject(self.model)
Settings(seriesShapeStyleEnable: self.$seriesShapeStyleEnable, categoryShapeStyleEnable: self.$categoryShapeStyleEnable).environmentObject(self.model)
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions Apps/Examples/Examples/FioriCharts/ChartsContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct ChartsContentView: View {

var body: some View {
List {
ForEach(0 ..< charts.count, id: \.self) { index in
ForEach(0 ..< self.charts.count, id: \.self) { index in
NavigationLink(destination: ChartHomeView(info: self.charts[index], isPopUp: self.$isPopUp)) {
Text(self.charts[index].0)
.font(.fiori(forTextStyle: .headline))
Expand All @@ -88,9 +88,9 @@ struct ChartHomeView: View {
GeometryReader { proxy in
self.makeBody(in: proxy.size)
}
.navigationBarTitle(info.0)
.navigationBarItems(trailing: Toggle("Popup", isOn: $isPopUp))
.sheet(isPresented: $showingDetail) {
.navigationBarTitle(self.info.0)
.navigationBarItems(trailing: Toggle("Popup", isOn: self.$isPopUp))
.sheet(isPresented: self.$showingDetail) {
ChartDetailView(model: self.currentModel!)
}
.onDisappear {
Expand All @@ -101,7 +101,7 @@ struct ChartHomeView: View {
func makeBody(in size: CGSize) -> some View {
var width: CGFloat

if self.horizontalSizeClass == .regular && self.verticalSizeClass == .regular {
if self.horizontalSizeClass == .regular, self.verticalSizeClass == .regular {
if #available(iOS 14, *) {
width = max((size.width - 48) / 2, 1)
} else {
Expand Down
4 changes: 2 additions & 2 deletions Apps/Examples/Examples/FioriCharts/SettingColor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ struct SettingColor: View {
let colorOptions: [Color] = ColorStyle.allCases.map { .preferredColor($0) }

var body: some View {
Picker(selection: $color, label: Text(title ?? "Select Color")) {
ForEach(0 ..< colorOptions.count, id: \.self) { index in
Picker(selection: self.$color, label: Text(self.title ?? "Select Color")) {
ForEach(0 ..< self.colorOptions.count, id: \.self) { index in
Rectangle()
.fill(self.colorOptions[index])
.tag(self.colorOptions[index])
Expand Down
38 changes: 19 additions & 19 deletions Apps/Examples/Examples/FioriCharts/Settings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,68 +13,68 @@ struct Settings: View {

return NavigationView {
Form {
NavigationLink("Selection", destination: SettingsSelection(model: model))
NavigationLink("Selection", destination: SettingsSelection(model: self.model))

NavigationLink("Series Collection", destination: SettingsSeriesCollection())

if model.colorsForCategory.count > 0 {
NavigationLink("Color for categories", destination: SettingsColorForCategory(model: model))
if self.model.colorsForCategory.count > 0 {
NavigationLink("Color for categories", destination: SettingsColorForCategory(model: self.model))
} else {
Text("Color for categories: 0")
}

Section(header: Text("Axis")) {
NavigationLink(destination: SettingsCategoryAxis(axis: $model.categoryAxis)) {
NavigationLink(destination: SettingsCategoryAxis(axis: self.$model.categoryAxis)) {
Text("Category Axis")
}

NavigationLink(destination: SettingsAxis(axis: $model.numericAxis)) {
NavigationLink(destination: SettingsAxis(axis: self.$model.numericAxis)) {
Text("Numeric Axis")
}

NavigationLink(destination: SettingsAxis(axis: $model.secondaryNumericAxis)) {
NavigationLink(destination: SettingsAxis(axis: self.$model.secondaryNumericAxis)) {
Text("Secondary Numeric Axis")
}

Text("Number of Gridlines: \(nf.string(from: NSNumber(value: Double(model.numberOfGridlines))) ?? "")")
Slider(value: $model.numberOfGridlines.double, in: -1 ... 30, step: 1)
Text("Number of Gridlines: \(nf.string(from: NSNumber(value: Double(self.model.numberOfGridlines))) ?? "")")
Slider(value: self.$model.numberOfGridlines.double, in: -1 ... 30, step: 1)

Picker(selection: $model.xAxisLabelsPosition, label: Text("X Axis Labels Position")) {
Picker(selection: self.$model.xAxisLabelsPosition, label: Text("X Axis Labels Position")) {
Text("Dynamic").tag(XAxisLabelsPosition.dynamic)
Text("Fixed bottom").tag(XAxisLabelsPosition.fixedBottom)
}
}

if model.chartType == .stock || model.chartType == .line || model.chartType == .area || model.chartType == .combo || model.chartType == .waterfall {
if self.model.chartType == .stock || self.model.chartType == .line || self.model.chartType == .area || self.model.chartType == .combo || self.model.chartType == .waterfall {
Section(header: Text("Index Set")) {
if model.chartType == .stock {
if self.model.chartType == .stock {
Stepper("Index of Stock Series: \(self.model.indexOfStockSeries)", onIncrement: {
self.model.indexOfStockSeries = (self.model.indexOfStockSeries + 1) % max(1, self.model.numOfSeries())
}, onDecrement: {
self.model.indexOfStockSeries = (self.model.indexOfStockSeries - 1 + self.model.numOfSeries()) % max(1, self.model.numOfSeries())
})
}

if model.chartType == .line || model.chartType == .area || model.chartType == .combo {
NavigationLink(destination: SettingsIndexSet(indexSet: $model.indexesOfSecondaryValueAxis, num: model.numOfSeries())) { Text("Indexes Of Secondary Value Axis:")
if self.model.chartType == .line || self.model.chartType == .area || self.model.chartType == .combo {
NavigationLink(destination: SettingsIndexSet(indexSet: self.$model.indexesOfSecondaryValueAxis, num: self.model.numOfSeries())) { Text("Indexes Of Secondary Value Axis:")
}
}

if model.chartType == .combo {
NavigationLink(destination: SettingsIndexSet(indexSet: $model.indexesOfColumnSeries, num: model.numOfSeries())) { Text("Indexes Of Column Series")
if self.model.chartType == .combo {
NavigationLink(destination: SettingsIndexSet(indexSet: self.$model.indexesOfColumnSeries, num: self.model.numOfSeries())) { Text("Indexes Of Column Series")
}
}

if model.chartType == .waterfall {
NavigationLink(destination: SettingsIndexSet(indexSet: $model.indexesOfTotalsCategories, num: model.numOfCategories(in: 0))) { Text("Indexes Of Totals Categoriess")
if self.model.chartType == .waterfall {
NavigationLink(destination: SettingsIndexSet(indexSet: self.$model.indexesOfTotalsCategories, num: self.model.numOfCategories(in: 0))) { Text("Indexes Of Totals Categoriess")
}
}
}
}

Section(header: Text("ShapeStyle")) {
Toggle("Series ShapeStyle", isOn: $seriesShapeStyleEnable)
Toggle("Category ShapeStyle", isOn: $categoryShapeStyleEnable)
Toggle("Series ShapeStyle", isOn: self.$seriesShapeStyleEnable)
Toggle("Category ShapeStyle", isOn: self.$categoryShapeStyleEnable)
}
}.navigationBarTitle("Configuration")
}
Expand Down
24 changes: 13 additions & 11 deletions Apps/Examples/Examples/FioriCharts/SettingsAxis.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ struct SettingsAxis: View {
var body: some View {
Form {
Section(header: Text("Basic")) {
Toggle(isOn: $axis.isZeroBased) {
Toggle(isOn: self.$axis.isZeroBased) {
Text("Is Zero Based")
}

Toggle(isOn: $axis.abbreviatesLabels) {
Toggle(isOn: self.$axis.abbreviatesLabels) {
Text("Is Abbreviated Labels")
}

Toggle(isOn: $axis.isMagnitudedDisplayed) {
Toggle(isOn: self.$axis.isMagnitudedDisplayed) {
Text("Is Magnituded Displayed")
}

HStack(alignment: .center) {
Text("Explicit Min: ")

TextField("", text: $textExplicitMin, onCommit: {
TextField("", text: self.$textExplicitMin, onCommit: {
if let val = NumberFormatter().number(from: self.textExplicitMin) {
self.axis.explicitMin = CGFloat(truncating: val)
}
Expand All @@ -34,14 +34,14 @@ struct SettingsAxis: View {
HStack(alignment: .center) {
Text("Explicit Max: ")

TextField("", text: $textExplicitMax, onCommit: {
TextField("", text: self.$textExplicitMax, onCommit: {
if let val = NumberFormatter().number(from: self.textExplicitMax) {
self.axis.explicitMax = CGFloat(truncating: val)
}
}).textFieldStyle(RoundedBorderTextFieldStyle())
}

Picker(selection: $axis.formatter.numberStyle, label: Text("Number Formatter Style")) {
Picker(selection: self.$axis.formatter.numberStyle, label: Text("Number Formatter Style")) {
Text("decimal").tag(NumberFormatter.Style.decimal)
Text("percent").tag(NumberFormatter.Style.percent)
Text("currency").tag(NumberFormatter.Style.currency)
Expand All @@ -52,7 +52,7 @@ struct SettingsAxis: View {
Text("none").tag(NumberFormatter.Style.none)
}

Picker(selection: $axis.abbreviatedFormatter.numberStyle, label: Text("Abbreviated Number Formatter Style")) {
Picker(selection: self.$axis.abbreviatedFormatter.numberStyle, label: Text("Abbreviated Number Formatter Style")) {
Text("decimal").tag(NumberFormatter.Style.decimal)
Text("percent").tag(NumberFormatter.Style.percent)
Text("currency").tag(NumberFormatter.Style.currency)
Expand All @@ -66,22 +66,24 @@ struct SettingsAxis: View {

Section(header: Text("Line")) {
NavigationLink(destination:
SettingsBaseline(line: $axis.baseline)) {
SettingsBaseline(line: self.$axis.baseline))
{
Text("Baseline")
}

NavigationLink(destination:
SettingsLine(line: $axis.gridlines)) {
SettingsLine(line: self.$axis.gridlines))
{
Text("Gridlines")
}
}

Section(header: Text("Label")) {
NavigationLink(destination: SettingsLabel(label: $axis.labels)) {
NavigationLink(destination: SettingsLabel(label: self.$axis.labels)) {
Text("Axis Gridline Label")
}

NavigationLink(destination: SettingsLabel(label: $axis.titleLabel)) {
NavigationLink(destination: SettingsLabel(label: self.$axis.titleLabel)) {
Text("Axis Title Label")
}
}
Expand Down
16 changes: 8 additions & 8 deletions Apps/Examples/Examples/FioriCharts/SettingsBaseline.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ struct SettingsBaseline: View {

return Form {
Section(header: Text("Basic")) {
Toggle(isOn: $line.isHidden) {
Toggle(isOn: self.$line.isHidden) {
Text("Is Hidden")
}

Text("Line width: \(nf.string(from: NSNumber(value: Double(line.width))) ?? "")")
Slider(value: $line.width, in: 1 ... 10, step: 1)
Text("Line width: \(nf.string(from: NSNumber(value: Double(self.line.width))) ?? "")")
Slider(value: self.$line.width, in: 1 ... 10, step: 1)

SettingColor(color: $line.color)
SettingColor(color: self.$line.color)
}

Section(header: Text("Dash Pattern")) {
Text("Length: \(nf.string(from: NSNumber(value: Double(line.dashPatternLength))) ?? "")")
Slider(value: $line.dashPatternLength, in: 1 ... 20, step: 1)
Text("Length: \(nf.string(from: NSNumber(value: Double(self.line.dashPatternLength))) ?? "")")
Slider(value: self.$line.dashPatternLength, in: 1 ... 20, step: 1)

Text("Gap: \(nf.string(from: NSNumber(value: Double(line.dashPatternGap))) ?? "")")
Slider(value: $line.dashPatternGap, in: 0 ... 20, step: 1)
Text("Gap: \(nf.string(from: NSNumber(value: Double(self.line.dashPatternGap))) ?? "")")
Slider(value: self.$line.dashPatternGap, in: 0 ... 20, step: 1)
}
}.navigationBarTitle("Line Attributes")
}
Expand Down
Loading

0 comments on commit 0099b37

Please sign in to comment.