Skip to content

Commit

Permalink
Merge branch 'ebulanik-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
fulldecent committed Aug 27, 2020
2 parents d04b5f0 + fef4eb8 commit 864b374
Show file tree
Hide file tree
Showing 21 changed files with 925 additions and 869 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file.

## [Master](https://github.com/fulldecent/FDSoundActivatedRecorder/compare/3.1.1...master)

#### Added
- Updated example to use SwiftPT, issue [#25](https://github.com/fulldecent/FDSoundActivatedRecorder/issues/30).
- Added by [Engin Bulanık](https://github.com/fulldecent/FDSoundActivatedRecorder/pull/36).

---

## [3.1.1](https://github.com/fulldecent/FDSoundActivatedRecorder/releases/tag/3.0.0)
Expand All @@ -18,7 +22,7 @@ All notable changes to this project will be documented in this file.
## [3.1.0](https://github.com/fulldecent/FDSoundActivatedRecorder/releases/tag/3.0.0)

#### Added
- Introspection for activations, issue [#25](https://github.com/fulldecent/FDSoundActivatedRecorder/issues/25)
- Introspection for activations, issue [#25](https://github.com/fulldecent/FDSoundActivatedRecorder/issues/25).

---

Expand Down
37 changes: 37 additions & 0 deletions SwiftUI Example/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// AppDelegate.swift
// SwiftUI Example
//
// Created by Engin BULANIK on 26.08.2020.
// Copyright © 2020 William Entriken. All rights reserved.
//

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
}

// 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)
}

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.
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions SwiftUI Example/Sources/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina6_1" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
Expand Down
112 changes: 112 additions & 0 deletions SwiftUI Example/Sources/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
//
// ContentView.swift
// FDSoundActivatedRecorder-SwiftUI
//
// Created by Engin BULANIK on 25.08.2020.
// Copyright © 2020 William Entriken. All rights reserved.
//

import SwiftUI

struct ContentView: View {
@EnvironmentObject var viewModel: FDSoundActivatedRecorderViewModel

var body: some View {

VStack(spacing: 10){
Text("Recording times out after 10 seconds")
Button(action: self.viewModel.pressedStartListening) {
Text("startListening")
.frame(width: viewModel.menuWidth)
.padding()
.background(Color.yellow)
.foregroundColor(Color.white)
.cornerRadius(20)
}

Button(action: self.viewModel.pressedStartRecording) {
Text("startRecording")
.frame(width: viewModel.menuWidth)
.padding()
.background(Color.red)
.foregroundColor(Color.white)
.cornerRadius(20)
}

Button(action: self.viewModel.pressedStopAndSaveRecording) {
Text("stopAndSaveRecording")
.frame(width: viewModel.menuWidth)
.padding()
.background(Color.blue)
.foregroundColor(Color.white)
.cornerRadius(20)
}

Button(action: self.viewModel.pressedAbort) {
Text("abort")
.frame(width: viewModel.menuWidth)
.padding()
.background(Color.black)
.foregroundColor(Color.white)
.cornerRadius(20)
}

// Mic level
Text("Microphone level")
Rectangle()
.fill(Color.gray)
.frame(width: self.viewModel.menuWidth, height: 10)
.overlay(Rectangle()
.fill(Color.red)
.frame(width: self.viewModel.progressBarLevel * self.viewModel.menuWidth, height: 10))
.frame(height: 20)

Text(viewModel.microphoneLevel)

Button(action: {
// What to perform
self.viewModel.pressedPlay()
}) {
// How the button looks like
Text("play")
.frame(width: viewModel.menuWidth)
.padding()
.background(Color.green)
.foregroundColor(Color.white)
.cornerRadius(20)
}.disabled(self.viewModel.savedURL == nil)

// Graph Animation
GeometryReader { geometry in
HStack(spacing: 0) {
Spacer()
ForEach(self.viewModel.sampleSquares, id: \.id) { sample in
VStack {
Spacer()
Rectangle()
.fill(sample.color)
.frame(width: self.viewModel.graphSampleSize, height: self.viewModel.graphSampleSize)
Spacer()
.frame(height: sample.value * geometry.size.height)
}.overlay(
VStack {
Spacer()
Rectangle()
.fill(sample.thresholdColor)
.frame(width: self.viewModel.graphSampleSize, height: self.viewModel.graphSampleSize)
Spacer()
.frame(height: sample.thresholdValue * geometry.size.height)
}
)
}
}
}
}
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Loading

0 comments on commit 864b374

Please sign in to comment.