Skip to content

Instantly share code, notes, and snippets.

View thatswiftguy's full-sized avatar
🎯
Focusing

Yasir thatswiftguy

🎯
Focusing
View GitHub Profile
@thatswiftguy
thatswiftguy / VoiceViewModel.swift
Created February 13, 2021 15:12
This Snippet of Code Includes the Start Recording and Stop Feature
import Foundation
import AVFoundation
class VoiceViewModel : NSObject , ObservableObject , AVAudioPlayerDelegate {
var audioRecorder : AVAudioRecorder!
var audioPlayer : AVAudioPlayer!
@Published var isRecording : Bool = false
```
import Foundation
struct mySortedArray<T: Comparable> {
// We are Creating an Array and intialise it
var array = [T]()
init(array: [T]) {
self.array = array.sorted()
}