Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use template where clause to avoid a runtime type test. #14

Open
wants to merge 30 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f1ee537
Use template where clause to avoid a runtime type test.
jackpal Aug 1, 2020
7766031
Beta 4 fixes
Dimillian Aug 5, 2020
10bf0a3
Proper settings view
Dimillian Aug 5, 2020
8e43c8a
WIP quick search + display awards
Dimillian Aug 5, 2020
3194a45
Settings + WIP search
Dimillian Aug 9, 2020
124533e
Rich text suppor for flair + flair & awards for comments.
Dimillian Aug 10, 2020
67e3a9d
About community + subreddit icon in toolbar
Dimillian Aug 12, 2020
e16f776
New commnts system + share picker
Dimillian Aug 12, 2020
de011fe
New menu shortcuts
Dimillian Aug 12, 2020
4004482
Better route handling
Dimillian Aug 13, 2020
54959d9
Subscribe / Favorite from about popover
Dimillian Aug 18, 2020
343d75a
WIP
Dimillian Aug 19, 2020
ddec324
Fixes on toolbar and post row
Dimillian Sep 4, 2020
11e74fb
Replace SDWebImage with KingFisher
Dimillian Sep 4, 2020
eacc4c3
Cleanup
Dimillian Sep 8, 2020
0fa0475
Big Sur Beta 7 update
Dimillian Sep 22, 2020
fb9c638
Cleanup profile + improve search
Dimillian Sep 30, 2020
dcb7102
Fixes
Dimillian Sep 30, 2020
a2bcd59
Various improvements + update KinfFisher
Dimillian Oct 1, 2020
42c0021
Color fixes
Dimillian Oct 6, 2020
ab54c18
Update README.md
Dimillian Nov 13, 2020
914cd1b
Fix tests
Dimillian Dec 1, 2020
da6c201
Fixed typo on line 07
kant Nov 19, 2020
840810b
Various fixes
Dimillian Dec 16, 2020
79368dd
added clear instructions of how to add secrets.plist
rursache Dec 5, 2020
2b37ee4
Update README.md
Dimillian Dec 31, 2020
46aa0e0
Introduce url extension to help avoid force unwrapping for static url…
DanKorkelia Jan 1, 2021
aa2687f
Restore development team name in project file
DanKorkelia Jan 1, 2021
81fd956
Update function signiture
DanKorkelia Jan 1, 2021
31f9ad3
Improve call site usage
DanKorkelia Jan 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions Packages/Backend/Sources/Backend/Models/Listing.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,24 @@ public struct ListingHolder<T: Decodable>: Decodable {
case kind, data
}

public init(from decoder: Decoder) throws {
public init(from decoder: Decoder) throws
where T == GenericListingContent
{
let container = try decoder.container(keyedBy: CodingKeys.self)
kind = try container.decode(String.self, forKey: .kind)
if T.self == GenericListingContent.self {
data = try GenericListingContent(from: decoder) as! T
} else {
data = try container.decode(T.self, forKey: .data)
}
data = try T(from: decoder)
}

public init(from decoder: Decoder) throws
{
let container = try decoder.container(keyedBy: CodingKeys.self)
kind = try container.decode(String.self, forKey: .kind)
// This assert can be removed before merging the
// patch. It's just here to verify that
// the specialized init, above, is used for
// when T is a GenericListingContent.
assert(T.self != GenericListingContent.self)
data = try container.decode(T.self, forKey: .data)
}
}

Expand Down