This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Combine | |
import ShazamKit | |
import AVKit | |
@MainActor | |
class HomeViewModel: NSObject, ObservableObject { | |
// 1 | |
@Published private(set) var mediaItems: [SHMediaItem] = [] | |
// 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Swift | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workflows: | |
ios-workflow: | |
name: iOS Workflow | |
environment: | |
vars: | |
XCODE_PROJECT: "CICDExample.xcodeproj" | |
XCODE_SCHEME: "CICDExample" | |
BUNDLE_ID: "com.rudrankriyam.cicdexample" | |
APP_STORE_CONNECT_ISSUER_ID: Encrypted(...) | |
APP_STORE_CONNECT_KEY_IDENTIFIER: Encrypted(...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct RGBView: View { | |
@State var targetRed = random() | |
@State var targetGreen = random() | |
@State var targetBlue = random() | |
@State var yourRed = rgbColor | |
@State var yourGreen = rgbColor | |
@State var yourBlue = rgbColor | |
// rest of the thousands of lines of code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RGBViewModel: ObservableObject { | |
@Published var targetColor: RGBColorProtocol | |
@Published var userColor: RGBColorProtocol | |
init(targetColor: RGBColorProtocol, userColor: RGBColorProtocol) { | |
self.targetColor = targetColor | |
self.userColor = userColor | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RGBRandomColor: RGBColorProtocol { | |
var red: Double = Constants.random | |
var green: Double = Constants.random | |
var blue: Double = Constants.random | |
} | |
class RGBUserColor: RGBColorProtocol { | |
static let initial: Double = 188/255 | |
var red: Double = RGBInitialColor.initial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol GradientProtocol { | |
var startColor: ColorProtocol { get set } | |
var endColor: ColorProtocol { get set } | |
func new() -> Gradient | |
} | |
extension GradientProtocol { | |
func new() -> Gradient { | |
Gradient(colors: [startColor.new(), endColor.new()]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol RGBColorProtocol: ColorProtocol { | |
var red: Double { get set } | |
var green: Double { get set } | |
var blue: Double { get set } | |
} | |
extension RGBColorProtocol { | |
func new() -> Color { | |
Color(red: red, green: green, blue: blue) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MusicRowView(song: song) | |
.swipeActions(edge: .leading) { | |
Button { | |
withAnimation { | |
// Mark the song favorite | |
} | |
} label: { | |
Label("Favorite", systemImage: "star") | |
} | |
.tint(.brand) |