-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to set iOS artboard volume through RiveModel
Updates the `RiveModel` API with the ability to set and get the volume for the currently set artboard. Any new artboards will default to use the last-set volume of the model. A volume default of 1.0 is set to match rive-cpp's default. `RiveArtboard` is also updated to forward volume calls to the artboard instance, exposing a new `volume` property. There's an open question whether this belongs in `RiveViewModel`, or `RiveModel`, but I went for `RiveModel` since there's a direct reference to the artboard within the model itself, and an indirect reference through the view model (model?.artboard) Diffs= a31cd9761 Add ability to set iOS artboard volume through RiveModel (#7658) Co-authored-by: David Skuza <david@rive.app>
- Loading branch information
Showing
8 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
114da4e39ba61dd337e8f6f47c1c7b2fb2223915 | ||
a31cd9761efdc411d4c462f065e37d84af04984c |
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// | ||
// RiveModelTests.swift | ||
// RiveRuntimeTests | ||
// | ||
// Created by David Skuza on 7/23/24. | ||
// Copyright © 2024 Rive. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import RiveRuntime | ||
|
||
class RiveModelTests: XCTestCase { | ||
func test_volume() throws { | ||
let file = try RiveFile(testfileName: "multipleartboards") | ||
let model = RiveModel(riveFile: file) | ||
|
||
XCTAssertEqual(model.volume, 1) | ||
|
||
do { | ||
try model.setArtboard() | ||
|
||
model.volume = 0.5 | ||
XCTAssertEqual(model.volume, 0.5) | ||
XCTAssertEqual(model.artboard?.__volume, 0.5) | ||
} | ||
|
||
do { | ||
try model.setArtboard("artboard2") | ||
|
||
XCTAssertEqual(model.volume, 0.5) | ||
XCTAssertEqual(model.artboard?.__volume, 0.5) | ||
|
||
model.volume = 0 | ||
XCTAssertEqual(model.volume, 0) | ||
XCTAssertEqual(model.artboard?.__volume, 0) | ||
} | ||
} | ||
} |