Skip to content

Commit

Permalink
Merge pull request #15 from enebin/release/0.3.0
Browse files Browse the repository at this point in the history
release/0.3.0
  • Loading branch information
enebin authored Jun 30, 2023
2 parents 211845a + ec26ed0 commit 1015107
Show file tree
Hide file tree
Showing 47 changed files with 2,152 additions and 969 deletions.
406 changes: 406 additions & 0 deletions Demo/Aespa-iOS.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
101 changes: 101 additions & 0 deletions Demo/Aespa-iOS.xcodeproj/xcshareddata/xcschemes/Aespa-iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9CE5B7D72A306F350058334D"
BuildableName = "Aespa-iOS.app"
BlueprintName = "Aespa-iOS"
ReferencedContainer = "container:Aespa-iOS.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9CE5B7E72A306F370058334D"
BuildableName = "Aespa-iOSTests.xctest"
BlueprintName = "Aespa-iOSTests"
ReferencedContainer = "container:Aespa-iOS.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9CE5B7F12A306F370058334D"
BuildableName = "Aespa-iOSUITests.xctest"
BlueprintName = "Aespa-iOSUITests"
ReferencedContainer = "container:Aespa-iOS.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9CE5B7D72A306F350058334D"
BuildableName = "Aespa-iOS.app"
BlueprintName = "Aespa-iOS"
ReferencedContainer = "container:Aespa-iOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9CE5B7D72A306F350058334D"
BuildableName = "Aespa-iOS.app"
BlueprintName = "Aespa-iOS"
ReferencedContainer = "container:Aespa-iOS.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
5 changes: 5 additions & 0 deletions Demo/Aespa-iOS/Aespa-iOS.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
17 changes: 17 additions & 0 deletions Demo/Aespa-iOS/Aespa_iOSApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Aespa_iOSApp.swift
// Aespa-iOS
//
// Created by 이영빈 on 2023/06/07.
//

import SwiftUI

@main
struct Aespa_iOSApp: App {
var body: some Scene {
WindowGroup {
VideoContentView()
}
}
}
11 changes: 11 additions & 0 deletions Demo/Aespa-iOS/Assets.xcassets/AccentColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
13 changes: 13 additions & 0 deletions Demo/Aespa-iOS/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions Demo/Aespa-iOS/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
78 changes: 78 additions & 0 deletions Demo/Aespa-iOS/GalleryView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//
// GalleryView.swift
// Aespa-iOS
//
// Created by 이영빈 on 2023/06/12.
//

import Aespa
import SwiftUI

struct GalleryView: View {
@ObservedObject var viewModel: VideoContentViewModel

@Binding private var mediaType: MediaType

init(
mediaType: Binding<MediaType>,
contentViewModel viewModel: VideoContentViewModel
) {
self._mediaType = mediaType
self.viewModel = viewModel
}

var body: some View {
VStack(alignment: .center) {
Picker("File", selection: $mediaType) {
Text("Video").tag(MediaType.video)
Text("Photo").tag(MediaType.photo)
}
.pickerStyle(.segmented)
.frame(width: 200)
.padding(.vertical)

ScrollView {
switch mediaType {
case .photo:
LazyVGrid(
columns: [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())],
spacing: 5
) {
ForEach(viewModel.photoFiles) { file in
let image = Image(uiImage: file.thumbnail ?? UIImage())

image
.resizable()
.scaledToFill()
}
}
.onAppear {
viewModel.fetchPhotoFiles()
}
case .video:
LazyVGrid(
columns: [GridItem(.flexible()), GridItem(.flexible()), GridItem(.flexible())],
spacing: 5
) {
ForEach(viewModel.videoFiles) { file in
let image = Image(uiImage: file.thumbnail ?? UIImage())

image
.resizable()
.scaledToFill()
}
}
.onAppear {
viewModel.fetchVideoFiles()
}
}
}
}
}
}

struct GalleryView_Previews: PreviewProvider {
static var previews: some View {
GalleryView(mediaType: .constant(.video), contentViewModel: .init())
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
97 changes: 97 additions & 0 deletions Demo/Aespa-iOS/SettingView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
//
// SettingView.swift
// Aespa-iOS
//
// Created by Young Bin on 2023/06/08.
//

import SwiftUI
import AVFoundation

struct SettingView: View {
@ObservedObject var viewModel: VideoContentViewModel

@State private var quality: AVCaptureSession.Preset
@State private var focusMode: AVCaptureDevice.FocusMode

@State private var isMuted: Bool

@State private var flashMode: AVCaptureDevice.FlashMode

init(contentViewModel viewModel: VideoContentViewModel) {
self.viewModel = viewModel

self.quality = viewModel.aespaSession.avCaptureSession.sessionPreset
self.focusMode = viewModel.aespaSession.currentFocusMode ?? .continuousAutoFocus

self.isMuted = viewModel.aespaSession.isMuted

self.flashMode = viewModel.aespaSession.currentSetting.flashMode
}

var body: some View {
List {
Section(header: Text("Common")) {
Picker("Quality", selection: $quality) {
Text("Low").tag(AVCaptureSession.Preset.low)
Text("Medium").tag(AVCaptureSession.Preset.medium)
Text("High").tag(AVCaptureSession.Preset.high)
}
.modifier(TitledPicker(title: "Asset quality"))
.onChange(of: quality) { newValue in
viewModel.aespaSession.quality(to: newValue)
}

Picker("Focus", selection: $focusMode) {
Text("Auto").tag(AVCaptureDevice.FocusMode.autoFocus)
Text("Locked").tag(AVCaptureDevice.FocusMode.locked)
Text("Continuous").tag(AVCaptureDevice.FocusMode.continuousAutoFocus)
}
.modifier(TitledPicker(title: "Focus mode"))
.onChange(of: focusMode) { newValue in
viewModel.aespaSession.focus(mode: newValue)
}
}

Section(header: Text("Video")) {
Picker("Mute", selection: $isMuted) {
Text("Unmute").tag(false)
Text("Mute").tag(true)
}
.modifier(TitledPicker(title: "Mute"))
.onChange(of: isMuted) { newValue in
_ = newValue ?
viewModel.aespaSession.mute() :
viewModel.aespaSession.unmute()
}
}

Section(header: Text("Photo")) {
Picker("Flash", selection: $flashMode) {
Text("On").tag(AVCaptureDevice.FlashMode.on)
Text("Off").tag(AVCaptureDevice.FlashMode.off)
Text("Auto").tag(AVCaptureDevice.FlashMode.auto)
}
.modifier(TitledPicker(title: "Flash mode"))
.onChange(of: flashMode) { newValue in
viewModel.aespaSession.flashMode(to: newValue)
}
}
}
}

struct TitledPicker: ViewModifier {
let title: String
func body(content: Content) -> some View {
VStack(alignment: .leading) {
Text(title)
.foregroundColor(.gray)
.font(.caption)

content
.pickerStyle(.segmented)
.frame(height: 40)
}
}
}
}
Loading

0 comments on commit 1015107

Please sign in to comment.