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

migrate to Swift 5.9 #23

Open
wants to merge 1 commit into
base: master
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
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8
5.9
3 changes: 1 addition & 2 deletions iLepra/Extras/View+HTML.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ extension Element {
.toView()
.eraseToAny()
case "span":
let color: Color
switch try className() {
let color = switch try className() {
case "moderator":
color = .blue
case "irony":
Expand Down
8 changes: 4 additions & 4 deletions iLepra/LepraContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ struct LepraContentView: View {
private func view(for tab: LepraTab) -> some View {
switch tab {
case .feed:
return LepraFeedView(navigationPath: $navigationPathFeed, shouldReload: $shouldReloadFeed)
LepraFeedView(navigationPath: $navigationPathFeed, shouldReload: $shouldReloadFeed)
.environmentObject(feedViewModel)
.navigationTitle(tab.title)
.eraseToAny()
case .moar:
return LepraMoarView(navigationPath: $navigationPathMoar, shouldReload: $shouldReloadMoar)
LepraMoarView(navigationPath: $navigationPathMoar, shouldReload: $shouldReloadMoar)
.environmentObject(moarViewModel)
.navigationTitle(tab.title)
.badge(moarViewModel.unreadCount)
.eraseToAny()
case .domains:
return LepraDomainsView(navigationPath: $navigationPathDomains, shouldReload: $shouldReloadDomains)
LepraDomainsView(navigationPath: $navigationPathDomains, shouldReload: $shouldReloadDomains)
.environmentObject(domainsViewModel)
.navigationTitle(tab.title)
.eraseToAny()
case .profile:
return LepraProfileView(shouldReload: $shouldReloadProfile)
LepraProfileView(shouldReload: $shouldReloadProfile)
.environmentObject(profileViewModel)
.navigationTitle(tab.title)
.eraseToAny()
Expand Down
7 changes: 3 additions & 4 deletions iLepra/Screens/VotesDetails/LepraVotesDetailsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ final class LepraVotesDetailsViewModel: ObservableObject {
]
)

let result: AjaxVotes
if let votes {
result = .init(
let result: AjaxVotes = if let votes {
.init(
cons: .init((votes.cons + response.cons).uniqued()),
consCount: response.consCount,
karma: response.karma,
Expand All @@ -83,7 +82,7 @@ final class LepraVotesDetailsViewModel: ObservableObject {
totalCount: response.totalCount
)
} else {
result = response
response
}
await MainActor.run {
votes = result
Expand Down
24 changes: 12 additions & 12 deletions iLepra/Views/LepraTabView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@ enum LepraTab: Hashable, CaseIterable {
var title: String {
switch self {
case .feed:
return "Главная"
"Главная"
case .moar:
return "Мои вещи"
"Мои вещи"
case .domains:
return "Подлепры"
"Подлепры"
case .profile:
return "Профиль"
"Профиль"
}
}

var imageName: String {
switch self {
case .feed:
return "house"
"house"
case .moar:
return "bookmark"
"bookmark"
case .domains:
return "list.dash"
"list.dash"
case .profile:
return "brain.head.profile"
"brain.head.profile"
}
}
}
Expand Down Expand Up @@ -107,13 +107,13 @@ struct LepraTabView<LepraView: View>: View {
private func view(for tab: LepraTab) -> some View {
switch tab {
case .feed:
return feedView
feedView
case .moar:
return moarView
moarView
case .domains:
return domainsView
domainsView
case .profile:
return profileView
profileView
}
}
}
Expand Down