This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TaskModel.swift | |
// TaskManager | |
// | |
// Created by Mohammad Yasir on 11/04/21. | |
// | |
import Foundation | |
import SwiftUI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
enum WeatherStateImage : CaseIterable { | |
static let sun = UIImage(systemName: "sun.min") | |
static let cloud = UIImage(systemName: "cloud") | |
static let rainingCloud = UIImage(systemName: "cloud.drizzle") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
enum Dice { | |
case one | |
case two | |
case three | |
case four | |
case five | |
case six | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Book { | |
var title : String | |
var pages : Int | |
var chapters : Int | |
} | |
var book = Book(title: "The Swift Book", pages: 1030, chapters: 12) | |
print(book.pages) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Book { | |
// Properties | |
// Methods | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
struct recordingListView: View { | |
@ObservedObject var vm = VoiceViewModel() | |
var body: some View { | |
NavigationView { | |
VStack { | |
ScrollView(showsIndicators: false){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
@ObservedObject var vm = VoiceViewModel() | |
@State private var showingList = false | |
@State private var showingAlert = false | |
var body: some View { | |
ZStack{ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func deleteRecording(url : URL){ | |
do { | |
try FileManager.default.removeItem(at : url) | |
} catch { | |
print("Can't delete") | |
} | |
for i in 0..<recordingsList.count { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func startPlaying(url : URL) { | |
let playSession = AVAudioSession.sharedInstance() | |
do { | |
try playSession.overrideOutputAudioPort(AVAudioSession.PortOverride.speaker) | |
} catch { | |
print("Playing failed in Device") | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func fetchAllRecording(){ | |
let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] | |
let directoryContents = try! FileManager.default.contentsOfDirectory(at: path, includingPropertiesForKeys: nil) | |
for i in directoryContents { | |
recordingsList.append(Recording(fileURL : i, createdAt:getFileDate(for: i), isPlaying: false)) | |
} | |
recordingsList.sort(by: { $0.createdAt.compare($1.createdAt) == .orderedDescending}) |