Skip to content

Commit 6bfcd9a

Browse files
🤖 CI: Add build-package workflow
- Decrement `swift-tools-version` from 6.0 to 5.10.0
1 parent 3962dfa commit 6bfcd9a

File tree

5 files changed

+57
-14
lines changed

5 files changed

+57
-14
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Build Package
2+
3+
on:
4+
pull_request:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
build:
9+
runs-on: macos-latest
10+
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Swift
16+
uses: swift-actions/[email protected]
17+
with:
18+
swift-version: '5.10' # Should match swift-tools-version in Package.swift
19+
20+
- name: Build Control Library
21+
run: |
22+
xcodebuild -scheme Control \
23+
-sdk iphonesimulator \
24+
-configuration Release \
25+
-destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \
26+
BUILD_DIR=$(pwd)/build/Control
27+
28+
- name: Build Controllers Library
29+
run: |
30+
xcodebuild -scheme Controllers \
31+
-sdk iphonesimulator \
32+
-configuration Release \
33+
-destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' \
34+
BUILD_DIR=$(pwd)/build/Controllers
35+
36+
# Disabled until unit tests are added
37+
# - name: Run tests
38+
# run: swift test -v
39+

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.0
1+
// swift-tools-version: 5.10.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

Sources/Control/Volume.swift

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public extension Control {
3131
public static var isMuted = false {
3232
didSet {
3333
if isMuted {
34-
mutedVolumeLevel = volume
34+
Helpers.mutedVolumeLevel = volume
3535
}
36-
volume = isMuted ? 0 : mutedVolumeLevel
36+
volume = isMuted ? 0 : Helpers.mutedVolumeLevel
3737
}
3838
}
3939

@@ -44,7 +44,7 @@ public extension Control {
4444
/// - Important: Calling this function will _unmute_ the system volume. The increment amount is
4545
/// applied to the volume level prior to it being muted.
4646
public static func increaseVolume(
47-
@BetweenZeroAndOneInclusive _ amount: Float = defaultVolumeStep
47+
@BetweenZeroAndOneInclusive _ amount: Float = Helpers.defaultVolumeStep
4848
) {
4949
if isMuted {
5050
isMuted.toggle()
@@ -59,7 +59,7 @@ public extension Control {
5959
/// - Important: Calling this function will _unmute_ the system volume. The decrement amount is
6060
/// applied to the volume level prior to it being muted.
6161
public static func decreaseVolume(
62-
@BetweenZeroAndOneInclusive _ amount: Float = defaultVolumeStep
62+
@BetweenZeroAndOneInclusive _ amount: Float = Helpers.defaultVolumeStep
6363
) {
6464
if isMuted {
6565
isMuted.toggle()
@@ -71,12 +71,15 @@ public extension Control {
7171

7272
extension Control.Volume {
7373

74-
/// Refers to the volume level prior to it being muted.
75-
private static var mutedVolumeLevel: Float = 0
76-
77-
/// Refers to the amount (on scale from 0 to 1) the volume is incremented/decremented when the volume rocker is pressed on the phone.
78-
public static let defaultVolumeStep: Float = 1 / maxVolumeButtonPresses
79-
80-
/// Refers to the number of (volume rocker) button presses it takes for the phone's volume to go from 0 to max.
81-
private static let maxVolumeButtonPresses: Float = 16
74+
public enum Helpers {
75+
76+
/// Refers to the amount (on scale from 0 to 1) the volume is incremented/decremented when the volume rocker is pressed on the phone.
77+
public static let defaultVolumeStep: Float = 1 / maxVolumeButtonPresses
78+
79+
/// Refers to the volume level prior to it being muted.
80+
static var mutedVolumeLevel: Float = 0
81+
82+
/// Refers to the number of (volume rocker) button presses it takes for the phone's volume to go from 0 to max.
83+
private static let maxVolumeButtonPresses: Float = 16
84+
}
8285
}

Sources/Controllers/PlaybackController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//
55

66
/// Describes an object that controls media/audio playback
7+
@MainActor
78
protocol PlaybackController {
89

910
func togglePlayPause()

Sources/Controllers/SystemController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public final class SystemController: ObservableObject {
2626
}
2727
}
2828

29-
extension SystemController: @preconcurrency PlaybackController {
29+
extension SystemController: PlaybackController {
3030

3131
public func togglePlayPause() {
3232
switch selectedPlaybackType {

0 commit comments

Comments
 (0)