clean up code

This commit is contained in:
Duong Thai 2023-10-14 00:49:55 +07:00
parent d406972e81
commit 4e55aac679
11 changed files with 17 additions and 58 deletions

View file

@ -50,7 +50,6 @@ private struct WrapperView: View {
Text("Is Nil?")
}
}
.animation(.default)
.frame(width: 200, height: 100)
.padding()
}

View file

@ -65,16 +65,13 @@ private struct WrapperView: View {
var body: some View {
VStack {
HStack {
CompilersView(compilers: compilers)
.border(.red)
}
CompilersView(compilers: compilers)
.border(.red)
Spacer()
Toggle(isOn: $isNil) {
Text("Is Nil?")
}
}
.animation(.default)
.frame(width: 200, height: 100)
.padding()
}

View file

@ -42,22 +42,19 @@ private struct WrapperView: View {
@State var isIcon = false
var state: XcodeInstallState {
isIcon
? XcodeInstallState.notInstalled
: XcodeInstallState.installed(Path("/Applications/Xcode.app")!)
? XcodeInstallState.installed(Path("/Applications/Xcode.app")!)
: XcodeInstallState.notInstalled
}
var body: some View {
VStack {
HStack {
IconView(installState: state)
.border(.red)
}
IconView(installState: state)
.border(.red)
Spacer()
Toggle(isOn: $isIcon) {
Text("Is an Icon?")
Text("Icon?")
}
}
.animation(.default)
.frame(width: 300, height: 100)
.padding()
}

View file

@ -33,7 +33,6 @@ struct IdenticalBuildsView: View {
.font(.subheadline)
}
}
.frame(maxWidth: .infinity, alignment: .leading)
.accessibilityElement()
.accessibility(label: Text("IdenticalBuilds"))
.accessibility(value: Text(accessibilityDescription))
@ -67,16 +66,13 @@ private struct WrapperView: View {
var body: some View {
VStack {
HStack {
IdenticalBuildsView(builds: builds)
IdenticalBuildsView(builds: builds)
.border(.red)
}
Spacer()
Toggle(isOn: $isEmpty) {
Text("Is Empty?")
Text("No Builds?")
}
}
.animation(.default)
.frame(width: 300, height: 100)
.padding()
}

View file

@ -27,7 +27,6 @@ struct InfoPane: View {
)
case let .installing(installationStep):
InstallationStepDetailView(installationStep: installationStep)
.fixedSize(horizontal: false, vertical: true)
CancelInstallButton(xcode: xcode)
case .installed:
InstalledStateButtons(xcode: xcode)
@ -38,7 +37,6 @@ struct InfoPane: View {
Group {
ReleaseNotesView(url: xcode.releaseNotesURL)
ReleaseDateView(date: xcode.releaseDate)
.frame(maxWidth: .infinity, alignment: .leading)
IdenticalBuildsView(builds: xcode.identicalBuilds)
CompatibilityView(requiredMacOSVersion: xcode.requiredMacOSVersion)
SDKsView(sdks: xcode.sdks)
@ -54,23 +52,6 @@ struct InfoPane: View {
UnselectedView()
}
}
@ViewBuilder
private func downloadFileSize(for xcode: Xcode) -> some View {
// if we've downloaded it no need to show the download size
if let downloadFileSize = xcode.downloadFileSizeString, case .notInstalled = xcode.installState {
VStack(alignment: .leading) {
Text("DownloadSize")
.font(.headline)
.frame(maxWidth: .infinity, alignment: .leading)
Text("\(downloadFileSize)")
.font(.subheadline)
.frame(maxWidth: .infinity, alignment: .leading)
}
} else {
EmptyView()
}
}
}
struct InfoPane_Previews: PreviewProvider {

View file

@ -39,10 +39,11 @@ struct InstallDetailView_Previews: PreviewProvider {
}
)
)
InstallationStepDetailView(
installationStep: .unarchiving
)
}
.padding()
}
}

View file

@ -38,7 +38,6 @@ struct InstalledStateButtons: View {
Spacer()
UninstallButton(xcode: xcode)
}
}
}
}

View file

@ -22,8 +22,8 @@ struct NotInstalledStateButtons: View {
} label: {
Text("Install") .help("Install")
}
if let size = downloadFileSizeString {
Text("DownloadSize")
.font(.headline)
Text(size)

View file

@ -14,7 +14,7 @@ struct ReleaseDateView: View {
var body: some View {
if let date = date {
VStack(alignment: .leading) {
Text("ReleaseDate (old version)")
Text("ReleaseDate")
.font(.headline)
Text("\(date, style: .date)")
.font(.subheadline)
@ -41,16 +41,13 @@ private struct WrapperView: View {
var body: some View {
VStack {
HStack {
ReleaseDateView(date: date)
.border(.red)
}
ReleaseDateView(date: date)
.border(.red)
Spacer()
Toggle(isOn: $isNil) {
Text("Is Nil?")
}
}
.animation(.default)
.frame(width: 300, height: 100)
.padding()
}

View file

@ -46,16 +46,12 @@ private struct WrapperView: View {
var body: some View {
VStack {
HStack {
ReleaseNotesView(url: url)
.border(.red)
}
ReleaseNotesView(url: url).border(.red)
Spacer()
Toggle(isOn: $hasURL) {
Text("Has URL?")
}
}
.animation(.default)
.frame(width: 300, height: 100)
.padding()
}

View file

@ -65,16 +65,12 @@ private struct WrapperView: View {
var body: some View {
VStack {
HStack {
SDKsView(sdks: sdks)
.border(.red)
}
SDKsView(sdks: sdks).border(.red)
Spacer()
Toggle(isOn: $isNil) {
Text("Is Nil?")
}
}
.animation(.default)
.frame(width: 200, height: 100)
.padding()
}