This is a Matter TV Casting app for iOS and macOS that can be used to cast content to a TV. This app discovers TVs on the local network that act as commissioners, lets the user select one, sends the TV a User Directed Commissioning request, enters commissioning mode, advertises itself as a Commissionable Node and gets commissioned. Then it allows the user to send Matter commands to the TV.
Refer to the Matter Casting APIs documentation to build the Matter “Casting Client” into your consumer-facing mobile app.
Open the workspace:
cd examples/tv-casting-app/darwin open TvCastingDarwin.xcworkspace
Select the appropriate scheme:
TvCasting - Main iOS appMatterTvCastingBridge - Framework/librarySelect your target device (simulator or physical device)
Build and run: Cmd+R
Build the framework:
cd examples/tv-casting-app/darwin xcodebuild -workspace TvCastingDarwin.xcworkspace \ -scheme MatterTvCastingBridge \ -destination 'platform=iOS Simulator,name=iPhone 16' \ build
The Darwin TV Casting app includes unit tests for the SendUDC functionality and other features.
The test files have been created but require one-time setup in Xcode to add them to the project:
Open the project in Xcode:
cd examples/tv-casting-app/darwin open MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj
Add a test target (if not already present):
MatterTvCastingBridgeTestsMatterTvCastingBridgeAdd the test file to the test target:
MatterTvCastingBridgeTests folderMatterTvCastingBridgeTests/MCCastingPlayerSendUDCTests.mMatterTvCastingBridgeTests targetAdd OCMock dependency:
MatterTvCastingBridgeTests targetOnce the test target is configured:
Cmd+U to run all testsCmd+6) to browse and run testsAfter the test target is properly configured in Xcode:
cd examples/tv-casting-app/darwin xcodebuild test \ -project MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj \ -scheme MatterTvCastingBridge \ -destination 'platform=iOS Simulator,name=iPhone 16'
The SendUDC test suite (MCCastingPlayerSendUDCTests.m) includes 10 test cases covering:
If you prefer to review the test structure without setting up the test target:
cd examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridgeTests cat MCCastingPlayerSendUDCTests.m
The test file is complete and demonstrates proper usage of the SendUDC API with OCMock for mocking dependencies.
Issue: “Scheme is not currently configured for the test action”
Issue: Build errors when running tests
Issue: OCMock not found
For more details on the test implementation, see the test documentation.
This example Matter TV Casting Darwin app can be tested with the example Matter tv-app running on a Raspberry Pi or other supported platform.