Skip to content

Commit 29cfc13

Browse files
committed
self prefix
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
1 parent af1a42b commit 29cfc13

File tree

87 files changed

+1803
-1803
lines changed

Some content is hidden

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

87 files changed

+1803
-1803
lines changed

.swiftformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
--operatorfunc spaced
3434
--patternlet hoist
3535
--ranges spaced
36-
--self remove
36+
--self insert
3737
--selfrequired
3838
--semicolons never
3939
--shortoptionals always

App/KasetApp.swift

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ struct KasetApp: App {
8484
Color.clear
8585
.frame(width: 1, height: 1)
8686
} else {
87-
MainWindow(navigationSelection: $navigationSelection)
88-
.environment(authService)
89-
.environment(webKitManager)
90-
.environment(playerService)
91-
.environment(\.searchFocusTrigger, $searchFocusTrigger)
92-
.environment(\.navigationSelection, $navigationSelection)
87+
MainWindow(navigationSelection: self.$navigationSelection)
88+
.environment(self.authService)
89+
.environment(self.webKitManager)
90+
.environment(self.playerService)
91+
.environment(\.searchFocusTrigger, self.$searchFocusTrigger)
92+
.environment(\.navigationSelection, self.$navigationSelection)
9393
.task {
9494
// Check if user is already logged in from previous session
95-
await authService.checkLoginStatus()
95+
await self.authService.checkLoginStatus()
9696
}
9797
}
9898
}
@@ -101,37 +101,37 @@ struct KasetApp: App {
101101
CommandGroup(after: .appInfo) {
102102
Button("Sign Out") {
103103
Task {
104-
await authService.signOut()
104+
await self.authService.signOut()
105105
}
106106
}
107-
.disabled(authService.state == .loggedOut)
107+
.disabled(self.authService.state == .loggedOut)
108108
}
109109

110110
// Playback commands
111111
CommandMenu("Playback") {
112112
// Play/Pause - Space
113-
Button(playerService.isPlaying ? "Pause" : "Play") {
113+
Button(self.playerService.isPlaying ? "Pause" : "Play") {
114114
Task {
115-
await playerService.playPause()
115+
await self.playerService.playPause()
116116
}
117117
}
118118
.keyboardShortcut(.space, modifiers: [])
119-
.disabled(playerService.currentTrack == nil && playerService.pendingPlayVideoId == nil)
119+
.disabled(self.playerService.currentTrack == nil && self.playerService.pendingPlayVideoId == nil)
120120

121121
Divider()
122122

123123
// Next Track - ⌘→
124124
Button("Next") {
125125
Task {
126-
await playerService.next()
126+
await self.playerService.next()
127127
}
128128
}
129129
.keyboardShortcut(.rightArrow, modifiers: .command)
130130

131131
// Previous Track - ⌘←
132132
Button("Previous") {
133133
Task {
134-
await playerService.previous()
134+
await self.playerService.previous()
135135
}
136136
}
137137
.keyboardShortcut(.leftArrow, modifiers: .command)
@@ -141,47 +141,47 @@ struct KasetApp: App {
141141
// Volume Up - ⌘↑
142142
Button("Volume Up") {
143143
Task {
144-
await playerService.setVolume(min(1.0, playerService.volume + 0.1))
144+
await self.playerService.setVolume(min(1.0, self.playerService.volume + 0.1))
145145
}
146146
}
147147
.keyboardShortcut(.upArrow, modifiers: .command)
148148

149149
// Volume Down - ⌘↓
150150
Button("Volume Down") {
151151
Task {
152-
await playerService.setVolume(max(0.0, playerService.volume - 0.1))
152+
await self.playerService.setVolume(max(0.0, self.playerService.volume - 0.1))
153153
}
154154
}
155155
.keyboardShortcut(.downArrow, modifiers: .command)
156156

157157
// Mute - ⌘⇧M
158-
Button(playerService.isMuted ? "Unmute" : "Mute") {
158+
Button(self.playerService.isMuted ? "Unmute" : "Mute") {
159159
Task {
160-
await playerService.toggleMute()
160+
await self.playerService.toggleMute()
161161
}
162162
}
163163
.keyboardShortcut("m", modifiers: [.command, .shift])
164164

165165
Divider()
166166

167167
// Shuffle - ⌘S
168-
Button(playerService.shuffleEnabled ? "Shuffle Off" : "Shuffle On") {
169-
playerService.toggleShuffle()
168+
Button(self.playerService.shuffleEnabled ? "Shuffle Off" : "Shuffle On") {
169+
self.playerService.toggleShuffle()
170170
}
171171
.keyboardShortcut("s", modifiers: .command)
172172

173173
// Repeat - ⌘R
174-
Button(repeatModeLabel) {
175-
playerService.cycleRepeatMode()
174+
Button(self.repeatModeLabel) {
175+
self.playerService.cycleRepeatMode()
176176
}
177177
.keyboardShortcut("r", modifiers: .command)
178178

179179
Divider()
180180

181181
// Lyrics - ⌘L
182-
Button(playerService.showLyrics ? "Hide Lyrics" : "Show Lyrics") {
182+
Button(self.playerService.showLyrics ? "Hide Lyrics" : "Show Lyrics") {
183183
withAnimation(.easeInOut(duration: 0.2)) {
184-
playerService.showLyrics.toggle()
184+
self.playerService.showLyrics.toggle()
185185
}
186186
}
187187
.keyboardShortcut("l", modifiers: .command)
@@ -191,31 +191,31 @@ struct KasetApp: App {
191191
CommandGroup(replacing: .sidebar) {
192192
// Home - ⌘1
193193
Button("Home") {
194-
navigationSelection = .home
194+
self.navigationSelection = .home
195195
}
196196
.keyboardShortcut("1", modifiers: .command)
197197

198198
// Explore - ⌘2
199199
Button("Explore") {
200-
navigationSelection = .explore
200+
self.navigationSelection = .explore
201201
}
202202
.keyboardShortcut("2", modifiers: .command)
203203

204204
// Library - ⌘3
205205
Button("Library") {
206-
navigationSelection = .library
206+
self.navigationSelection = .library
207207
}
208208
.keyboardShortcut("3", modifiers: .command)
209209

210210
Divider()
211211

212212
// Search - ⌘F
213213
Button("Search") {
214-
navigationSelection = .search
214+
self.navigationSelection = .search
215215
// Trigger focus after a brief delay to allow view to appear
216216
Task { @MainActor in
217217
try? await Task.sleep(for: .milliseconds(100))
218-
searchFocusTrigger = true
218+
self.searchFocusTrigger = true
219219
}
220220
}
221221
.keyboardShortcut("f", modifiers: .command)
@@ -225,7 +225,7 @@ struct KasetApp: App {
225225

226226
/// Label for repeat mode menu item.
227227
private var repeatModeLabel: String {
228-
switch playerService.repeatMode {
228+
switch self.playerService.repeatMode {
229229
case .off:
230230
"Repeat All"
231231
case .all:

Core/Models/Album.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct Album: Identifiable, Codable, Hashable, Sendable {
1313

1414
/// Display string for artists (comma-separated).
1515
var artistsDisplay: String {
16-
artists?.map(\.name).joined(separator: ", ") ?? ""
16+
self.artists?.map(\.name).joined(separator: ", ") ?? ""
1717
}
1818
}
1919

@@ -24,44 +24,44 @@ extension Album {
2424
guard let albumId = data["browseId"] as? String ?? data["id"] as? String ?? data["albumId"] as? String else {
2525
// For inline album references (e.g., in song data), create a minimal album
2626
if let name = data["name"] as? String {
27-
id = UUID().uuidString
28-
title = name
29-
artists = nil
30-
thumbnailURL = nil
31-
year = nil
32-
trackCount = nil
27+
self.id = UUID().uuidString
28+
self.title = name
29+
self.artists = nil
30+
self.thumbnailURL = nil
31+
self.year = nil
32+
self.trackCount = nil
3333
return
3434
}
3535
return nil
3636
}
3737

38-
id = albumId
39-
title = (data["title"] as? String) ?? (data["name"] as? String) ?? "Unknown Album"
38+
self.id = albumId
39+
self.title = (data["title"] as? String) ?? (data["name"] as? String) ?? "Unknown Album"
4040

4141
// Parse artists
4242
if let artistsData = data["artists"] as? [[String: Any]] {
43-
artists = artistsData.compactMap { Artist(from: $0) }
43+
self.artists = artistsData.compactMap { Artist(from: $0) }
4444
} else {
45-
artists = nil
45+
self.artists = nil
4646
}
4747

4848
// Parse thumbnail
4949
if let thumbnails = data["thumbnails"] as? [[String: Any]],
5050
let lastThumbnail = thumbnails.last,
5151
let urlString = lastThumbnail["url"] as? String
5252
{
53-
thumbnailURL = URL(string: urlString)
53+
self.thumbnailURL = URL(string: urlString)
5454
} else {
55-
thumbnailURL = nil
55+
self.thumbnailURL = nil
5656
}
5757

58-
year = data["year"] as? String
58+
self.year = data["year"] as? String
5959

6060
// Parse track count
6161
if let count = data["trackCount"] as? Int {
62-
trackCount = count
62+
self.trackCount = count
6363
} else {
64-
trackCount = nil
64+
self.trackCount = nil
6565
}
6666
}
6767
}

Core/Models/Artist.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ extension Artist {
2323
// Artist ID is optional for inline references
2424
let artistId = (data["id"] as? String) ?? (data["browseId"] as? String) ?? UUID().uuidString
2525

26-
id = artistId
26+
self.id = artistId
2727
self.name = name
2828

2929
// Parse thumbnail
3030
if let thumbnails = data["thumbnails"] as? [[String: Any]],
3131
let lastThumbnail = thumbnails.last,
3232
let urlString = lastThumbnail["url"] as? String
3333
{
34-
thumbnailURL = URL(string: urlString)
34+
self.thumbnailURL = URL(string: urlString)
3535
} else {
36-
thumbnailURL = nil
36+
self.thumbnailURL = nil
3737
}
3838
}
3939
}

Core/Models/ArtistDetail.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ struct ArtistDetail: Sendable {
2222
/// Params for loading all songs.
2323
let songsParams: String?
2424

25-
var id: String { artist.id }
26-
var name: String { artist.name }
25+
var id: String { self.artist.id }
26+
var name: String { self.artist.name }
2727

2828
init(
2929
artist: Artist,

Core/Models/HomeResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ struct HomeResponse: Sendable {
66

77
/// Whether the home response is empty.
88
var isEmpty: Bool {
9-
sections.isEmpty || sections.allSatisfy(\.items.isEmpty)
9+
self.sections.isEmpty || self.sections.allSatisfy(\.items.isEmpty)
1010
}
1111

1212
static let empty = HomeResponse(sections: [])

Core/Models/LikeStatus.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ struct FeedbackTokens: Codable, Hashable, Sendable {
3737

3838
/// Returns the appropriate token for the desired action.
3939
func token(forAdding: Bool) -> String? {
40-
forAdding ? add : remove
40+
forAdding ? self.add : self.remove
4141
}
4242
}

Core/Models/Lyrics.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ struct Lyrics: Sendable, Equatable {
1111
let source: String?
1212

1313
/// Whether the song has lyrics available.
14-
var isAvailable: Bool { !text.isEmpty }
14+
var isAvailable: Bool { !self.text.isEmpty }
1515

1616
/// Lyrics split into individual lines for display.
1717
var lines: [String] {
18-
text.components(separatedBy: "\n")
18+
self.text.components(separatedBy: "\n")
1919
}
2020

2121
/// Creates an empty lyrics instance for songs without lyrics.

Core/Models/Playlist.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct Playlist: Identifiable, Codable, Hashable, Sendable {
1414
/// Whether this is an album (vs a playlist).
1515
/// Albums have IDs starting with "OLAK" or "MPRE".
1616
var isAlbum: Bool {
17-
id.hasPrefix("OLAK") || id.hasPrefix("MPRE")
17+
self.id.hasPrefix("OLAK") || self.id.hasPrefix("MPRE")
1818
}
1919

2020
/// Display string for track count.
@@ -31,38 +31,38 @@ extension Playlist {
3131
return nil
3232
}
3333

34-
id = playlistId
35-
title = (data["title"] as? String) ?? "Unknown Playlist"
36-
description = data["description"] as? String
34+
self.id = playlistId
35+
self.title = (data["title"] as? String) ?? "Unknown Playlist"
36+
self.description = data["description"] as? String
3737

3838
// Parse thumbnail
3939
if let thumbnails = data["thumbnails"] as? [[String: Any]],
4040
let lastThumbnail = thumbnails.last,
4141
let urlString = lastThumbnail["url"] as? String
4242
{
43-
thumbnailURL = URL(string: urlString)
43+
self.thumbnailURL = URL(string: urlString)
4444
} else {
45-
thumbnailURL = nil
45+
self.thumbnailURL = nil
4646
}
4747

4848
// Parse track count
4949
if let count = data["trackCount"] as? Int {
50-
trackCount = count
50+
self.trackCount = count
5151
} else if let countString = data["trackCount"] as? String,
5252
let count = Int(countString.replacingOccurrences(of: ",", with: ""))
5353
{
54-
trackCount = count
54+
self.trackCount = count
5555
} else {
56-
trackCount = nil
56+
self.trackCount = nil
5757
}
5858

5959
// Parse author
6060
if let authors = data["authors"] as? [[String: Any]],
6161
let firstAuthor = authors.first
6262
{
63-
author = firstAuthor["name"] as? String
63+
self.author = firstAuthor["name"] as? String
6464
} else {
65-
author = data["author"] as? String
65+
self.author = data["author"] as? String
6666
}
6767
}
6868
}
@@ -82,15 +82,15 @@ struct PlaylistDetail: Identifiable, Sendable {
8282
/// Whether this is an album (vs a playlist).
8383
/// Albums have IDs starting with "OLAK" or "MPRE".
8484
var isAlbum: Bool {
85-
id.hasPrefix("OLAK") || id.hasPrefix("MPRE")
85+
self.id.hasPrefix("OLAK") || self.id.hasPrefix("MPRE")
8686
}
8787

8888
init(playlist: Playlist, tracks: [Song], duration: String? = nil) {
89-
id = playlist.id
90-
title = playlist.title
91-
description = playlist.description
92-
thumbnailURL = playlist.thumbnailURL
93-
author = playlist.author
89+
self.id = playlist.id
90+
self.title = playlist.title
91+
self.description = playlist.description
92+
self.thumbnailURL = playlist.thumbnailURL
93+
self.author = playlist.author
9494
self.tracks = tracks
9595
self.duration = duration
9696
}

0 commit comments

Comments
 (0)