Skip to content

Commit

Permalink
Merge branch 'release/sora-ios-sdk-2022.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
miosakuma committed Feb 3, 2022
2 parents 4740cf5 + 31aac95 commit c871ee4
Show file tree
Hide file tree
Showing 13 changed files with 225 additions and 37 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build

on:
push:
paths-ignore:
- 'README.md'
- 'CHANGES.md'
- 'LICENSE'
schedule:
- cron: "0 0 * * *"

jobs:
build:
runs-on: macOS-latest
env:
XCODE: /Applications/Xcode_12.4.app
XCODE_SDK: iphoneos14.4
steps:
- uses: actions/checkout@v2
- name: Select Xcode Version
run: sudo xcode-select -s '${{ env.XCODE }}/Contents/Developer'
- name: Show Xcode Version
run: xcodebuild -version
- name: Show CocoaPods Version
run: pod --version
- name: Restore Pods
uses: actions/cache@v2
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Dependences
run: |
pod repo update
pod install
- name: Create Environment.swift
run: cp SoraQuickStart/Environment.example.swift SoraQuickStart/Environment.swift
- name: Build Xcode Project
run: |
set -o pipefail && \
xcodebuild \
-workspace 'SoraQuickStart.xcworkspace' \
-scheme 'SoraQuickStart' \
-sdk ${{ env.XCODE_SDK }} \
-arch arm64 \
-configuration Release \
-derivedDataPath build \
clean build \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO \
CODE_SIGN_IDENTITY= \
PROVISIONING_PROFILE=
- name: Check uncommitted unformatted code
run: |
./lint-format.sh
release:
if: contains(github.ref, 'tags/v')
needs: [build]
runs-on: macOS-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ fastlane/screenshots
*.swp
doc
*.xcworkspace
Environment.swift
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.5.1
8 changes: 8 additions & 0 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--exclude Pods
--indent 4
--semicolons inline
--trailingclosures
--wrapparameters after-first
--header strip

--disable redundantInit,sortedSwitchCases,strongOutlets,unusedArguments,wrapSwitchCases
41 changes: 41 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
included:
- SoraQuickStart
excluded:
- Pods
disabled_rules:
- identifier_name
- force_cast
- force_try
- cyclomatic_complexity
- function_body_length
- file_length
- line_length
- type_body_length
- weak_delegate
- opening_brace
- closing_brace
- anonymous_argument_in_multiline_closure
- conditional_returns_on_newline
- multiline_arguments
- multiline_arguments_brackets
- multiline_literal_brackets
- multiline_parameters
- multiline_parameters_brackets
- vertical_parameter_alignment
- vertical_parameter_alignment_on_call
- vertical_whitespace
- vertical_whitespace_between_cases
- vertical_whitespace_closing_braces
- vertical_whitespace_opening_braces
- colon
- comma
- comment_spacing
- trailing_comma
- trailing_newline
- trailing_whitespace
- closure_parameter_position
- closure_end_indentation
- closure_spacing
- for_where
- large_tuple
- todo
9 changes: 6 additions & 3 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
source 'https://cdn.cocoapods.org/'
source 'https://github.com/shiguredo/sora-ios-sdk-specs.git'
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '12.1'
platform :ios, '13.0'

target 'SoraQuickStart' do
use_frameworks!
pod 'Sora', '2021.3.1'
pod 'Sora', '2022.1.0'

pod 'SwiftLint'
pod 'SwiftFormat/CLI'

end
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Please read https://github.com/shiguredo/oss before use.

## システム条件

- iOS 12.1 以降
- iOS 13 以降
- アーキテクチャ arm64, x86_64 (シミュレーターの動作は未保証)
- macOS 12.0 以降
- Xcode 13.1
- Swift 5.5
- macOS 12.2 以降
- Xcode 13.2
- Swift 5.5.2
- CocoaPods 1.11.2 以降
- WebRTC SFU Sora 2021.1 以降
- WebRTC SFU Sora 2021.2 以降

Xcode と Swift のバージョンによっては、 Carthage と CocoaPods で取得できるバイナリに互換性がない可能性があります。詳しくは[ Sora iOS SDK ドキュメント](https://sora-ios-sdk.shiguredo.jp/) を参照してください。

Expand All @@ -34,4 +34,6 @@ Xcode と Swift のバージョンによっては、 Carthage と CocoaPods で
$ pod install
```

2. ``SoraQuickStart.xcworkspace`` を Xcode で開いてビルドします。
2. ``SoraQuickStart/Environment.example.swift`` のファイル名を ``SoraQuickStart/Environment.swift`` に変更し、接続情報を設定します。

3. ``SoraQuickStart.xcworkspace`` を Xcode で開いてビルドします。
45 changes: 45 additions & 0 deletions SoraQuickStart.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
91169197273126A80098FBFF /* Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91169196273126A80098FBFF /* Environment.swift */; };
91A4844226F9BB5100C18B76 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A4844126F9BB5100C18B76 /* AppDelegate.swift */; };
91A4844426F9BB5100C18B76 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A4844326F9BB5100C18B76 /* SceneDelegate.swift */; };
91A4844626F9BB5100C18B76 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 91A4844526F9BB5100C18B76 /* ViewController.swift */; };
Expand All @@ -16,6 +17,7 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
91169196273126A80098FBFF /* Environment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Environment.swift; sourceTree = "<group>"; };
91A4843E26F9BB5100C18B76 /* SoraQuickStart.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SoraQuickStart.app; sourceTree = BUILT_PRODUCTS_DIR; };
91A4844126F9BB5100C18B76 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
91A4844326F9BB5100C18B76 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -63,6 +65,7 @@
91A4844A26F9BB5100C18B76 /* Assets.xcassets */,
91A4844C26F9BB5100C18B76 /* LaunchScreen.storyboard */,
91A4844F26F9BB5100C18B76 /* Info.plist */,
91169196273126A80098FBFF /* Environment.swift */,
);
path = SoraQuickStart;
sourceTree = "<group>";
Expand All @@ -74,6 +77,8 @@
isa = PBXNativeTarget;
buildConfigurationList = 91A4845226F9BB5100C18B76 /* Build configuration list for PBXNativeTarget "SoraQuickStart" */;
buildPhases = (
915772F6274E183500A17984 /* Run SwiftFormat */,
915772F7274E184100A17984 /* Run SwiftLint */,
91A4843A26F9BB5100C18B76 /* Sources */,
91A4843B26F9BB5100C18B76 /* Frameworks */,
91A4843C26F9BB5100C18B76 /* Resources */,
Expand Down Expand Up @@ -132,12 +137,52 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
915772F6274E183500A17984 /* Run SwiftFormat */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run SwiftFormat";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which \"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\" >/dev/null; then\n \"${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat\" \"$SRCROOT\"\nelse\n echo \"warning: SwiftFormat not installed, download from https://github.com/nicklockwood/SwiftFormat\"\nfi\n";
};
915772F7274E184100A17984 /* Run SwiftLint */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Run SwiftLint";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which \"${PODS_ROOT}/SwiftLint/swiftlint\" >/dev/null; then\n ${PODS_ROOT}/SwiftLint/swiftlint --fix\n ${PODS_ROOT}/SwiftLint/swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
91A4843A26F9BB5100C18B76 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
91A4844626F9BB5100C18B76 /* ViewController.swift in Sources */,
91169197273126A80098FBFF /* Environment.swift in Sources */,
91A4844226F9BB5100C18B76 /* AppDelegate.swift in Sources */,
91A4844426F9BB5100C18B76 /* SceneDelegate.swift in Sources */,
);
Expand Down
10 changes: 2 additions & 8 deletions SoraQuickStart/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,22 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {



func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
true
}

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}


}

11 changes: 11 additions & 0 deletions SoraQuickStart/Environment.example.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation

enum Environment {

// 接続するサーバーのシグナリング URL
static let url = URL(string: "wss://sora.example.com/signaling")!

// チャネル ID
static let channelId = "sora"

}
5 changes: 0 additions & 5 deletions SoraQuickStart/SceneDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import UIKit

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?


func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
Expand Down Expand Up @@ -39,7 +37,4 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// Use this method to save data, release shared resources, and store enough scene-specific state information
// to restore the scene back to its current state.
}


}

21 changes: 6 additions & 15 deletions SoraQuickStart/ViewController.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import UIKit
import Sora

// 接続するサーバーのシグナリング URL
let soraURL = URL(string: "wss://sora.example.com/signaling")!

// チャネル ID
let soraChannelId = "sora"
import UIKit

class ViewController: UIViewController {

@IBOutlet weak var senderVideoView: VideoView!
@IBOutlet weak var receiverVideoView: VideoView!
@IBOutlet weak var connectImageView: UIImageView!
Expand All @@ -27,8 +20,8 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
Logger.shared.level = .debug
navigationItem.title = "\(soraChannelId)"

navigationItem.title = "\(Environment.channelId)"
}

// 接続ボタンの UI を更新します。
Expand Down Expand Up @@ -66,11 +59,11 @@ class ViewController: UIViewController {

func connect() {
// 接続の設定を行います。
let config = Configuration(url: soraURL,
channelId: soraChannelId,
let config = Configuration(url: Environment.url,
channelId: Environment.channelId,
role: .sendrecv,
multistreamEnabled: true)

// ストリームが追加されたら受信用の VideoView をストリームにセットします。
// このアプリでは、複数のユーザーが接続した場合は最後のユーザーの映像のみ描画します。
let publisherStreamId = config.publisherStreamId
Expand Down Expand Up @@ -113,6 +106,4 @@ class ViewController: UIViewController {
}
}
}

}

22 changes: 22 additions & 0 deletions lint-format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# ローカルで lint と formatter を実行するスクリプト
# 未フォーマットか lint でルール違反を検出したら終了ステータス 1 を返す
# GitHub Actions では未フォーマット箇所の有無の確認に使う

PODS_ROOT=Pods
SRCROOT=.
FORMAT=${PODS_ROOT}/SwiftFormat/CommandLineTool/swiftformat
LINT=${PODS_ROOT}/SwiftLint/swiftlint

# フォーマットの必要性を確認する
$FORMAT --lint $SRCROOT
format=$?

$FORMAT $SRCROOT
$LINT --fix $SRCROOT
$LINT $SRCROOT
lint=$?

test $format -eq 0 -a $lint -eq 0
exit $?

0 comments on commit c871ee4

Please sign in to comment.