(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
import SwiftUI | |
struct TaskTrigger<T: Equatable>: Equatable { | |
fileprivate enum TaskState<S: Equatable>: Equatable { | |
case inactive | |
case active(value: S, uniqueId: UUID? = nil) | |
} | |
fileprivate var state: TaskState<T> = .inactive |
// A URLSession extension that fetches data from a URL and decodes to some Decodable type. | |
// Usage: let user = try await URLSession.shared.decode(UserData.self, from: someURL) | |
// Note: this requires Swift 5.5. | |
extension URLSession { | |
func decode<T: Decodable>( | |
_ type: T.Type = T.self, | |
from url: URL, | |
keyDecodingStrategy: JSONDecoder.KeyDecodingStrategy = .useDefaultKeys, | |
dataDecodingStrategy: JSONDecoder.DataDecodingStrategy = .deferredToData, | |
dateDecodingStrategy: JSONDecoder.DateDecodingStrategy = .deferredToDate |
import UIKit | |
import AVFoundation | |
import Photos | |
import MobileCoreServices | |
class ViewController: UIViewController { | |
override func viewDidAppear(_ animated: Bool) { | |
super.viewDidAppear(animated) | |
startVideoToGIFProcess() |
#install ffmpeg if it is not installed | |
(brew list -1 | grep "ffmpeg" >/dev/null) || brew install ffmpeg | |
#update your ffmpeg distribution to the latest version | |
brew outdated ffmpeg || brew upgrade ffmpeg | |
#cleanup the destination folder | |
for file in `ls ffmpeg/*`; do rm -f $file; done; | |
#determine the last local ffmpeg version |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
mr Marathi | |
bs Bosnian | |
ee_TG Ewe (Togo) | |
ms Malay | |
kam_KE Kamba (Kenya) | |
mt Maltese | |
ha Hausa | |
es_HN Spanish (Honduras) | |
ml_IN Malayalam (India) | |
ro_MD Romanian (Moldova) |