Skip to content

Commit

Permalink
Merge pull request #7 from inamiy/VideoDetector
Browse files Browse the repository at this point in the history
Add VideoDetector example
  • Loading branch information
inamiy committed Sep 21, 2021
2 parents 5f446cc + 4cff413 commit f83210a
Show file tree
Hide file tree
Showing 23 changed files with 1,497 additions and 17 deletions.
17 changes: 17 additions & 0 deletions Examples/Actomaton-Gallery.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
3341066526EC80590032CEDA /* StateDiagramExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3341065E26EC80590032CEDA /* StateDiagramExample.swift */; };
3341066626EC80590032CEDA /* TodoExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3341065F26EC80590032CEDA /* TodoExample.swift */; };
3341066726EC80590032CEDA /* ExampleList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3341066026EC80590032CEDA /* ExampleList.swift */; };
339F821026FA23E3006809CE /* VideoDetectorExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 339F820F26FA23E3006809CE /* VideoDetectorExample.swift */; };
339F821226FA242E006809CE /* VideoDetector in Frameworks */ = {isa = PBXBuildFile; productRef = 339F821126FA242E006809CE /* VideoDetector */; };
33C0412226EA51D600C63C4D /* Counter in Frameworks */ = {isa = PBXBuildFile; productRef = 33C0412126EA51D600C63C4D /* Counter */; };
33C0412426EA54A600C63C4D /* Todo in Frameworks */ = {isa = PBXBuildFile; productRef = 33C0412326EA54A600C63C4D /* Todo */; };
33C0412626EA554800C63C4D /* StateDiagram in Frameworks */ = {isa = PBXBuildFile; productRef = 33C0412526EA554800C63C4D /* StateDiagram */; };
Expand Down Expand Up @@ -51,6 +53,7 @@
3341065E26EC80590032CEDA /* StateDiagramExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StateDiagramExample.swift; sourceTree = "<group>"; };
3341065F26EC80590032CEDA /* TodoExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodoExample.swift; sourceTree = "<group>"; };
3341066026EC80590032CEDA /* ExampleList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExampleList.swift; sourceTree = "<group>"; };
339F820F26FA23E3006809CE /* VideoDetectorExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoDetectorExample.swift; sourceTree = "<group>"; };
33C0412026EA519800C63C4D /* Actomaton-Gallery */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "Actomaton-Gallery"; path = ..; sourceTree = "<group>"; };
33C8526326ECF13400F3EB94 /* GameOfLifeExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GameOfLifeExample.swift; sourceTree = "<group>"; };
33E8F81726E3B374009CC65D /* Actomaton-Gallery.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Actomaton-Gallery.app"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -66,6 +69,7 @@
33C0412226EA51D600C63C4D /* Counter in Frameworks */,
33C8526226ECEF7F00F3EB94 /* GameOfLife in Frameworks */,
33C0412826EA5BDA00C63C4D /* Stopwatch in Frameworks */,
339F821226FA242E006809CE /* VideoDetector in Frameworks */,
33C0412A26EA5E7600C63C4D /* GitHub in Frameworks */,
33C0412626EA554800C63C4D /* StateDiagram in Frameworks */,
33C0413E26EA6FE800C63C4D /* DebugRoot in Frameworks */,
Expand Down Expand Up @@ -116,6 +120,7 @@
3341065B26EC80590032CEDA /* StopwatchExample.swift */,
3341065C26EC80590032CEDA /* GitHubExample.swift */,
33C8526326ECF13400F3EB94 /* GameOfLifeExample.swift */,
339F820F26FA23E3006809CE /* VideoDetectorExample.swift */,
);
path = Examples;
sourceTree = "<group>";
Expand Down Expand Up @@ -192,6 +197,7 @@
33C0412B26EA650E00C63C4D /* TimeTravel */,
33C0413D26EA6FE800C63C4D /* DebugRoot */,
33C8526126ECEF7F00F3EB94 /* GameOfLife */,
339F821126FA242E006809CE /* VideoDetector */,
);
productName = "Actomaton-Gallery";
productReference = 33E8F81726E3B374009CC65D /* Actomaton-Gallery.app */;
Expand Down Expand Up @@ -251,6 +257,7 @@
buildActionMask = 2147483647;
files = (
3326431B26E4057D00438A10 /* Root.swift in Sources */,
339F821026FA23E3006809CE /* VideoDetectorExample.swift in Sources */,
3326433E26E4094200438A10 /* AppView.swift in Sources */,
3341066226EC80590032CEDA /* StopwatchExample.swift in Sources */,
3326433F26E4094200438A10 /* RootEnvironment.swift in Sources */,
Expand Down Expand Up @@ -394,12 +401,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Actomaton-Gallery/Preview Content\"";
DEVELOPMENT_TEAM = UMBZ5WL247;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSCameraUsageDescription = "Uses Camera";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand All @@ -413,6 +422,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.Actomaton-Gallery";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -426,12 +436,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Actomaton-Gallery/Preview Content\"";
DEVELOPMENT_TEAM = UMBZ5WL247;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_NSCameraUsageDescription = "Uses Camera";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand All @@ -445,6 +457,7 @@
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.inamiy.Actomaton-Gallery";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down Expand Up @@ -475,6 +488,10 @@
/* End XCConfigurationList section */

/* Begin XCSwiftPackageProductDependency section */
339F821126FA242E006809CE /* VideoDetector */ = {
isa = XCSwiftPackageProductDependency;
productName = VideoDetector;
};
33C0412126EA51D600C63C4D /* Counter */ = {
isa = XCSwiftPackageProductDependency;
productName = Counter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@
"repositoryURL": "https://github.com/inamiy/Actomaton",
"state": {
"branch": "main",
"revision": "1dc9592624259c7141e80e6fcc8276b600919810",
"revision": "4bc47a28e30b0dd449556df3068f1f4466794bdd",
"version": null
}
},
{
"package": "OrientationKit",
"repositoryURL": "https://github.com/inamiy/OrientationKit",
"state": {
"branch": null,
"revision": "491927e9cc835c0fcc7eac349c0245024f5d8579",
"version": "0.1.0"
}
},
{
"package": "swift-case-paths",
"repositoryURL": "https://github.com/pointfreeco/swift-case-paths",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ let exampleList: [Example] = [
StateDiagramExample(),
StopwatchExample(),
GitHubExample(),
GameOfLifeExample()
GameOfLifeExample(),
VideoDetectorExample()
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import SwiftUI
import ActomatonStore
import VideoDetector

struct VideoDetectorExample: Example
{
var exampleIcon: Image { Image(systemName: "video") }

var exampleInitialState: Root.State.Current
{
.videoDetector(VideoDetector.State())
}

func exampleView(store: Store<Root.Action, Root.State>.Proxy) -> AnyView
{
Self.exampleView(
store: store,
actionPath: /Root.Action.videoDetector,
statePath: /Root.State.Current.videoDetector,
makeView: VideoDetectorView.init
)
}
}
15 changes: 9 additions & 6 deletions Examples/Actomaton-Gallery/Root/Root.State.Current.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import StateDiagram
import Stopwatch
import GitHub
import GameOfLife
import VideoDetector

extension Root.State
{
Expand All @@ -17,17 +18,19 @@ extension Root.State
case todo(Todo.State)
case github(GitHub.State)
case gameOfLife(GameOfLife.Root.State)
case videoDetector(VideoDetector.State)

@MainActor
var example: Example
{
switch self {
case .counter: return CounterExample()
case .stopwatch: return StopwatchExample()
case .stateDiagram: return StateDiagramExample()
case .todo: return TodoExample()
case .github: return GitHubExample()
case .gameOfLife: return GameOfLifeExample()
case .counter: return CounterExample()
case .stopwatch: return StopwatchExample()
case .stateDiagram: return StateDiagramExample()
case .todo: return TodoExample()
case .github: return GitHubExample()
case .gameOfLife: return GameOfLifeExample()
case .videoDetector: return VideoDetectorExample()
}
}
}
Expand Down
10 changes: 9 additions & 1 deletion Examples/Actomaton-Gallery/Root/Root.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import StateDiagram
import Stopwatch
import GitHub
import GameOfLife
import VideoDetector

/// Root namespace.
/// - Todo: Move to Swift Package (but compile doesn't work well in Xcode 13 beta 5)
Expand All @@ -23,6 +24,7 @@ extension Root
case todo(Todo.Action)
case github(GitHub.Action)
case gameOfLife(GameOfLife.Root.Action)
case videoDetector(VideoDetector.Action)
}

public struct State: Equatable
Expand Down Expand Up @@ -74,7 +76,13 @@ extension Root
.contramap(action: /Action.gameOfLife)
.contramap(state: /State.Current.gameOfLife)
.contramap(state: \State.current)
.contramap(environment: { $0.gameOfLife })
.contramap(environment: { $0.gameOfLife }),

VideoDetector.reducer
.contramap(action: /Action.videoDetector)
.contramap(state: /State.Current.videoDetector)
.contramap(state: \State.current)
.contramap(environment: { _ in () })
)
}

Expand Down
15 changes: 15 additions & 0 deletions Examples/Actomaton-UIKit-Gallery.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
33655D1926F0D8AB007947CF /* TodoExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33655D0D26F0D8AB007947CF /* TodoExample.swift */; };
33655D1C26F0D8AB007947CF /* Root.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33655D1026F0D8AB007947CF /* Root.swift */; };
33655D1D26F0D8AB007947CF /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33655D1126F0D8AB007947CF /* RootView.swift */; };
339F821426FA34DA006809CE /* VideoDetectorExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 339F821326FA34DA006809CE /* VideoDetectorExample.swift */; };
339F821626FA3506006809CE /* VideoDetector in Frameworks */ = {isa = PBXBuildFile; productRef = 339F821526FA3506006809CE /* VideoDetector */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand All @@ -59,6 +61,7 @@
33655D0D26F0D8AB007947CF /* TodoExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TodoExample.swift; sourceTree = "<group>"; };
33655D1026F0D8AB007947CF /* Root.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Root.swift; sourceTree = "<group>"; };
33655D1126F0D8AB007947CF /* RootView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; };
339F821326FA34DA006809CE /* VideoDetectorExample.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VideoDetectorExample.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -69,6 +72,7 @@
33655CC126F0C2C2007947CF /* DebugRoot in Frameworks */,
33655CC526F0C2C2007947CF /* GitHub in Frameworks */,
33655CCD26F0C2C2007947CF /* Todo in Frameworks */,
339F821626FA3506006809CE /* VideoDetector in Frameworks */,
33655CC926F0C2C2007947CF /* Stopwatch in Frameworks */,
33655CCB26F0C2C2007947CF /* TimeTravel in Frameworks */,
33655CC726F0C2C2007947CF /* StateDiagram in Frameworks */,
Expand Down Expand Up @@ -168,6 +172,7 @@
332580E926F5783D0074B02D /* CounterRouteUIKitExample.swift */,
33655D0C26F0D8AB007947CF /* StateDiagramExample.swift */,
33655D0D26F0D8AB007947CF /* TodoExample.swift */,
339F821326FA34DA006809CE /* VideoDetectorExample.swift */,
);
path = Examples;
sourceTree = "<group>";
Expand Down Expand Up @@ -197,6 +202,7 @@
33655CC826F0C2C2007947CF /* Stopwatch */,
33655CCA26F0C2C2007947CF /* TimeTravel */,
33655CCC26F0C2C2007947CF /* Todo */,
339F821526FA3506006809CE /* VideoDetector */,
);
productName = "Actomaton-UIKit-Gallery";
productReference = 33655CA126F0BFB0007947CF /* Actomaton-UIKit-Gallery.app */;
Expand Down Expand Up @@ -258,6 +264,7 @@
33655CA526F0BFB0007947CF /* AppDelegate.swift in Sources */,
332580F326F583AC0074B02D /* TabBuilder.swift in Sources */,
33655D1526F0D8AB007947CF /* GitHubExample.swift in Sources */,
339F821426FA34DA006809CE /* VideoDetectorExample.swift in Sources */,
332580F026F57DE10074B02D /* Stopwatch.Environment.live.swift in Sources */,
33655D1926F0D8AB007947CF /* TodoExample.swift in Sources */,
33655D1C26F0D8AB007947CF /* Root.swift in Sources */,
Expand Down Expand Up @@ -401,7 +408,9 @@
DEVELOPMENT_TEAM = UMBZ5WL247;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Actomaton-UIKit-Gallery/Info.plist";
INFOPLIST_KEY_NSCameraUsageDescription = "Uses Camera";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -427,7 +436,9 @@
DEVELOPMENT_TEAM = UMBZ5WL247;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = "Actomaton-UIKit-Gallery/Info.plist";
INFOPLIST_KEY_NSCameraUsageDescription = "Uses Camera";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
LD_RUNPATH_SEARCH_PATHS = (
Expand Down Expand Up @@ -499,6 +510,10 @@
isa = XCSwiftPackageProductDependency;
productName = Todo;
};
339F821526FA3506006809CE /* VideoDetector */ = {
isa = XCSwiftPackageProductDependency;
productName = VideoDetector;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 33655C9926F0BFB0007947CF /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@
"version": null
}
},
{
"package": "OrientationKit",
"repositoryURL": "https://github.com/inamiy/OrientationKit",
"state": {
"branch": null,
"revision": "491927e9cc835c0fcc7eac349c0245024f5d8579",
"version": "0.1.0"
}
},
{
"package": "swift-case-paths",
"repositoryURL": "https://github.com/pointfreeco/swift-case-paths",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import SwiftUI
import ActomatonStore
import VideoDetector

struct VideoDetectorExample: Example
{
var exampleIcon: Image { Image(systemName: "video") }

@MainActor
func build() -> UIViewController
{
HostingViewController(
store: Store(
state: .init(),
reducer: VideoDetector.reducer,
environment: ()
),
makeView: VideoDetectorView.init
)
}
}
5 changes: 0 additions & 5 deletions Examples/Actomaton-UIKit-Gallery/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UILaunchScreen</key>
<dict>
<key>UILaunchScreen</key>
<dict/>
</dict>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down
3 changes: 2 additions & 1 deletion Examples/Actomaton-UIKit-Gallery/Tab/TabBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ enum TabBuilder
StateDiagramExample(),
StopwatchExample(),
GitHubExample(),
GameOfLifeExample()
GameOfLifeExample(),
VideoDetectorExample()
]
)
]
Expand Down
11 changes: 10 additions & 1 deletion Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,19 @@
"repositoryURL": "https://github.com/inamiy/Actomaton",
"state": {
"branch": "main",
"revision": "0685e173544d06fd79d8faa1343f6e34fd6210a8",
"revision": "4bc47a28e30b0dd449556df3068f1f4466794bdd",
"version": null
}
},
{
"package": "OrientationKit",
"repositoryURL": "https://github.com/inamiy/OrientationKit",
"state": {
"branch": null,
"revision": "491927e9cc835c0fcc7eac349c0245024f5d8579",
"version": "0.1.0"
}
},
{
"package": "swift-case-paths",
"repositoryURL": "https://github.com/pointfreeco/swift-case-paths",
Expand Down
Loading

0 comments on commit f83210a

Please sign in to comment.