Skip to content

Commit

Permalink
feat/#95 :: Data에 toDTO extension 추가
Browse files Browse the repository at this point in the history
Co-Authored-By: Youngkyu Song <[email protected]>
  • Loading branch information
Kiyoung-Kim-57 and youn9k committed Nov 25, 2024
1 parent 412b30e commit 0f2b391
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Foundation

public extension Data {
func toDTO(type: Decodable.Type) -> Decodable? {
func toDTO<T: Decodable>(type: T.Type) -> T? {
return try? JSONDecoder().decode(type, from: self)
}
}

0 comments on commit 0f2b391

Please sign in to comment.