Skip to content

Commit

Permalink
Binding 変数をオプションに変更する
Browse files Browse the repository at this point in the history
  • Loading branch information
zztkm committed Oct 2, 2024
1 parent a93561e commit bfc1119
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Sora/SwiftUIVideoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public struct SwiftUIVideoView<Background>: View where Background: View {

// TODO(zztkm): わかりやすいコメントを書く
// 親 View で定義された stopVideo 変数と接続するための変数
@Binding private var stopVideo: Bool
@Binding private var stopVideo: Bool?

@ObservedObject private var controller: VideoController

Expand All @@ -20,7 +20,7 @@ public struct SwiftUIVideoView<Background>: View where Background: View {
- parameter stream: 描画される映像ストリーム。 nil の場合は何も描画されません
*/
public init(_ stream: MediaStream?, stopVideo: Binding<Bool> = false) where Background == EmptyView {
public init(_ stream: MediaStream?, stopVideo: Binding<Bool>? = nil) where Background == EmptyView {
self.init(stream, background: EmptyView(), stopVideo: stopVideo)
}

Expand All @@ -30,10 +30,10 @@ public struct SwiftUIVideoView<Background>: View where Background: View {
- parameter stream: 描画される映像ストリーム nil の場合は何も描画されません
- paramater background: 映像のクリア時に表示する背景ビュー
*/
public init(_ stream: MediaStream?, background: Background, stopVideo: Binding<Bool>) {
public init(_ stream: MediaStream?, background: Background, stopVideo: Binding<Bool>?) {
self.stream = stream
self.background = background
_stopVideo = stopVideo
self._stopVideo = stopVideo
controller = VideoController(stream: stream)
}

Expand Down

0 comments on commit bfc1119

Please sign in to comment.