Skip to content

Commit

Permalink
Bootstrap iOS port of the tv-casting-app (#18924)
Browse files Browse the repository at this point in the history
* Removing old Obj-C darwin dir for tv-casting-app

* Added new directory structure for a Swift based TvCastingApp for iOS
  • Loading branch information
sharadb-amazon authored and pull[bot] committed Jul 13, 2023
1 parent 2aeada2 commit 1269762
Show file tree
Hide file tree
Showing 43 changed files with 732 additions and 2,226 deletions.
1 change: 1 addition & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,7 @@ ttyACMx
ttymxc
ttyUSB
TurbidityConcentrationMeasurement
TvCasting
TXD
txt
uargument
Expand Down
166 changes: 166 additions & 0 deletions examples/tv-casting-app/darwin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
### C++ ###
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

### Objective-C ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

# CocoaPods
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
# Pods/
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# fastlane
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

### Objective-C Patch ###

### Swift ###
# Xcode
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore






## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# CocoaPods
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
# Pods/
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts


# Accio dependency management
Dependencies/
.accio/

# fastlane
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control


# Code Injection
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode


### Xcode ###

## Xcode 8 and earlier

### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings

Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@
* limitations under the License.
*/

#import "ViewController.h"
#import <Foundation/Foundation.h>

@interface ViewController ()
#ifndef CastingServerBridge_h
#define CastingServerBridge_h

@end

@implementation ViewController
@interface CastingServerBridge : NSObject

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (int)add:(int)a secondNum:(int)b;

@end

#endif /* CastingServerBridge_h */
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
* limitations under the License.
*/

#import <UIKit/UIKit.h>
#import "CastingServerBridge.h"

@interface ViewController : UIViewController
@implementation CastingServerBridge

- (int)add:(int)a secondNum:(int)b
{
return a + b;
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
* limitations under the License.
*/

#import <UIKit/UIKit.h>
//
// TvCasting's Public headers exposed to Swift
//

@interface ViewController : UIViewController

@end
#import "CastingServerBridge.h"
80 changes: 80 additions & 0 deletions examples/tv-casting-app/darwin/TvCasting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Matter TV Casting iOS App Example

This is a Matter TV Casting iOS app 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 ContentLauncher commands to
the TV.

---

- [Matter TV Casting iOS App Example](#matter-tv-casting-ios-app-example)
- [Building the Application](#building-the-application)
- [Compilation Fixes](#compilation-fixes)
- [Installing the Application](#installing-the-application)

---

## Building the Application

Matter TV Casting iOS App Example can be built with the latest Xcode releases.

- Open the `TvCastingDarwin.xcworkspace` file located in
`examples/tv-casting-app/darwin` with Xcode.

- Then select the `TvCasting` scheme at the top.

- Running the `TvCasting` scheme in Xcode (select the scheme and then hit the
"play button" to "run" the scheme) will attempt to compile the application
and then install it to the connected iOS device selected in the scheme.

Because we do not share a developer group, directly running this scheme will
fail with missing signing configuration errors.

You need to update the Project configuration for TvCasting app to use your
Personal Developer account and a unique Bundle ID.

### Compilation Fixes

Before you can run the `TvCasting` scheme, you need to amend the
`project.pbxproj` file for the TvCasting app project. The file is located here
`examples/tv-casting-app/darwin/TvCasting/TvCasting.xcodeproj/project.pbxproj`.

You can choose to amend this file via Xcode directly or manually with any text
editor. This Readme will focus on doing it via Xcode.

- With the `TvCastingDarwin.xcworkspace` loaded, you should see 1 project on
the left side pane in Xcode. `TvCasting`

- Selecting `TvCasting` should bring up the project configuration view in
Xcode. Next, select the `Signing & Capabilities` tab.

- Perform the following steps to enable building TvCasting app:

1. Ensure "Automatically manage signing" is checked

2. Select your Personal Team in the "Team" dropdown.

3. Change the bundle identifier from `com.matter.TvCasting` to something
unique, like `com.matter.TvCasting-username`. These bundle IDs get
reserved for a short amount of time and so it's best to use something
only you might think of to avoid conflicts (you'll see that the default
bundle ID does not work if you skip this step).

4. Confirm that the Signing Certificate now says "Apple Development:
<your personal account>"

Now you can install TvCasting app to your connected iOS device by clicking on
the "Play"/Run icon.

## Installing the Application

The first time you install this application to your iOS device, Xcode will not
be able to launch it. This is because iOS prevents arbitrary developer apps from
running prior to user consent. To give this application consent, navigate to
`Settings->General->VPN & Device Management` and give TvCasting app permission
to run.

Now you can launch the application from the Home screen or from Xcode by hitting
the run button once more.
Loading

0 comments on commit 1269762

Please sign in to comment.