-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from AgoraIO-Community/410-update
DocC Tutorial and 4.1.0 Update
- Loading branch information
Showing
22 changed files
with
233 additions
and
11 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
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,2 @@ | ||
disabled_rules: | ||
- todo |
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
Binary file added
BIN
+173 KB
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Resources/agora-uikit-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.1 KB
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Resources/agora-x-swiftui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions
16
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Resources/code/quickstart-swiftui-01.swift
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,16 @@ | ||
// | ||
// quickstart-swiftui.swift | ||
// | ||
// | ||
// Created by Max Cobb on 15/12/2022. | ||
// | ||
|
||
import SwiftUI | ||
import AgoraRtcKit | ||
import AgoraUIKit | ||
|
||
struct ContentView: View { | ||
|
||
var body: some View { | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Resources/code/quickstart-swiftui-02.swift
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,26 @@ | ||
// | ||
// quickstart-swiftui.swift | ||
// | ||
// | ||
// Created by Max Cobb on 15/12/2022. | ||
// | ||
|
||
import SwiftUI | ||
import AgoraRtcKit | ||
import AgoraUIKit | ||
|
||
struct ContentView: View { | ||
|
||
static var agview = AgoraViewer( | ||
connectionData: AgoraConnectionData( | ||
appId: <#Agora App ID#> | ||
), | ||
style: .floating | ||
) | ||
|
||
var body: some View { | ||
ZStack { | ||
ContentView.agview | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Resources/code/quickstart-swiftui-03.swift
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,41 @@ | ||
// | ||
// quickstart-swiftui.swift | ||
// | ||
// | ||
// Created by Max Cobb on 15/12/2022. | ||
// | ||
|
||
import SwiftUI | ||
import AgoraRtcKit | ||
import AgoraUIKit | ||
|
||
struct ContentView: View { | ||
|
||
static var agview = AgoraViewer( | ||
connectionData: AgoraConnectionData( | ||
appId: <#Agora App ID#> | ||
), | ||
style: .floating | ||
) | ||
|
||
@State private var connectedToChannel = false | ||
|
||
var body: some View { | ||
ZStack { | ||
ContentView.agview | ||
if !connectedToChannel { | ||
Button( | ||
action: { | ||
// TODO: Add Join Channel Logic | ||
connectedToChannel = true | ||
}, label: { | ||
Text("Connect") | ||
.padding(3.0) | ||
.background(Color.green) | ||
.cornerRadius(3.0) | ||
} | ||
) | ||
} | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Resources/code/quickstart-swiftui-04.swift
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,45 @@ | ||
// | ||
// quickstart-swiftui.swift | ||
// | ||
// | ||
// Created by Max Cobb on 15/12/2022. | ||
// | ||
|
||
import SwiftUI | ||
import AgoraRtcKit | ||
import AgoraUIKit | ||
|
||
struct ContentView: View { | ||
|
||
static var agview = AgoraViewer( | ||
connectionData: AgoraConnectionData( | ||
appId: <#Agora App ID#> | ||
), | ||
style: .floating | ||
) | ||
|
||
@State private var connectedToChannel = false | ||
|
||
var body: some View { | ||
ZStack { | ||
ContentView.agview | ||
if !connectedToChannel { | ||
Button( | ||
action: { | ||
ContentView.agview.join( | ||
channel: "channel-name", | ||
with: <#Temporary Token#>, | ||
as: .broadcaster | ||
) | ||
connectedToChannel = true | ||
}, label: { | ||
Text("Connect") | ||
.padding(3.0) | ||
.background(Color.green) | ||
.cornerRadius(3.0) | ||
} | ||
) | ||
} | ||
} | ||
} | ||
} |
Binary file modified
BIN
-4.35 MB
(24%)
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Resources/custom-camera-both.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+7.64 KB
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Resources/quickstart-swiftui-button.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+81.7 KB
.../Agora-Video-UIKit/AgoraUIKit.docc/Resources/quickstart-swiftui-permissions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+64.1 KB
...es/Agora-Video-UIKit/AgoraUIKit.docc/Resources/quickstart-swiftui-videoview.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions
13
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Tutorials/TOC.tutorial
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,13 @@ | ||
@Tutorials(name: "Agora Video UI Kit") { | ||
@Intro(title: "Video UI Kit Tutorials") { | ||
These tutorials will show you how to use Agora's Video UI Kit. | ||
} | ||
|
||
@Chapter(name: "Getting Started with SwiftUI") { | ||
@Image(source: agora-x-swiftui, alt: "Agora + SwiftUI Logo") | ||
|
||
The basics of using Agora Video UI Kit with a SwiftUI Application | ||
|
||
@TutorialReference(tutorial: "doc:UsingSwiftUI") | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
Sources/Agora-Video-UIKit/AgoraUIKit.docc/Tutorials/UsingSwiftUI.tutorial
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,60 @@ | ||
@Tutorial(time: 5) { | ||
@Intro(title: "Agora UI Kit + SwiftUI") { | ||
How to get started with Agora's Video UI Kit in SwiftUI | ||
|
||
@Image(source: agora-uikit-banner, alt: "Video UI Kit Banner Image") | ||
} | ||
|
||
@Section(title: "Create a Video Viewer") { | ||
@ContentAndMedia { | ||
Let's make a SwiftUI Video Call App! | ||
|
||
After creating a new SwiftUI project with Xcode, you must add the Swift Package of Agora Video UI Kit using this URL: | ||
`https://github.com/AgoraIO-Community/VideoUIKit-iOS` | ||
|
||
And add camera and microphone permissions to your Info.plist: | ||
|
||
@Image(source: quickstart-swiftui-permissions, alt: "A screenshot showing the Camera and Microphone permissions in Info.plist") | ||
|
||
} | ||
|
||
@Steps { | ||
@Step { | ||
Import Agora's Video UI Kit, as well as the core RTC Kit. | ||
|
||
@Code(name: Quickstart-SwiftUI.swift, file: quickstart-swiftui-01.swift) | ||
} | ||
|
||
@Step { | ||
Create an ``AgoraUIKit/AgoraViewer`` as a static variable on your ContentView struct. This uses the initialisers, ``AgoraUIKit/AgoraViewer/init(connectionData:style:agoraSettings:delegate:)`` and ``AgoraUIKit/AgoraConnectionData/init(appId:rtcToken:rtmToken:idLogic:)``, with the App ID from your [Agora Console](https://console.agora.io). | ||
|
||
Add the newly created ``AgoraUIKit/AgoraViewer`` to your body inside of a ZStack. | ||
|
||
@Code(name: Quickstart-SwiftUI.swift, file: quickstart-swiftui-02.swift) { | ||
@Image(source: quickstart-swiftui-button.png, alt: "A screenshot of the SwiftUI View with just a button visible") | ||
} | ||
} | ||
|
||
@Step { | ||
We still need to call the method ``AgoraUIKit/AgoraViewer/join(channel:with:as:mediaOptions:)`` in order to join an Agora Channel. To do so, let's first add a button to the ZStack. | ||
|
||
The button appears ontop of the ``AgoraUIKit/AgoraViewer``, and once tapped will disappear from the view | ||
|
||
@Code(name: Quickstart-SwiftUI.swift, file: quickstart-swiftui-03.swift) { | ||
@Image(source: quickstart-swiftui-button.png, alt: "A screenshot of the SwiftUI View with just a button visible") | ||
} | ||
} | ||
|
||
@Step { | ||
Finally, call the ``AgoraUIKit/AgoraViewer/join(channel:with:as:mediaOptions:)`` function in the Button action to join the Agora Video Channel. | ||
|
||
For the temporary token, you can put `nil` in there if your project is still in testing and does not require a token. Otherwise create a temporary token from the [Agora Console](https://console.agora.io). | ||
|
||
@Code(name: Quickstart-SwiftUI.swift, file: quickstart-swiftui-04.swift) { | ||
@Image(source: quickstart-swiftui-videoview, alt: "A screenshot of the SwiftUI View with just a button visible") | ||
} | ||
} | ||
|
||
} | ||
} | ||
} |
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