mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-09 13:28:43 +02:00
Fixed metatdata
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Extensions.swift
|
||||
// App
|
||||
//
|
||||
// Created by Rasmus Krämer on 14.04.22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension String: Error {}
|
||||
|
||||
extension Encodable {
|
||||
func asDictionary() throws -> [String: Any] {
|
||||
let data = try JSONEncoder().encode(self)
|
||||
guard let dictionary = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [String: Any] else {
|
||||
throw NSError()
|
||||
}
|
||||
return dictionary
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user