Likers always nil #280
Unanswered
Partyschnitzel
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello! I try to get the likers for a media object.
/----- View
var mediaString: String = ""
mediaString = model.userposts![0].identifier!
@ObservedObject var modelLikers: MediaModel
modelLikers = .init(mediaName: mediaString)
let mediaLiker = modelLikers.likers
/------ Model
@published private(set) var current: User?
@published private(set) var likers: [User]?
init(mediaName: String) {
// Update current
User
every time secret is.// In a real app you would cache this.
secret.removeDuplicates { $0?.identifier == $1?.identifier }
.flatMap { secret -> AnyPublisher<User?, Never> in
guard let secret = secret else { return Just(nil).eraseToAnyPublisher() }
// Fetch the user.
return Endpoint.user(secret.identifier)
.unlock(with: secret)
.session(.instagram)
.map(.user)
.catch { _ in Just(nil) }
.eraseToAnyPublisher()
}
.receive(on: RunLoop.main)
.assign(to: .current, on: self)
.store(in: &bin)
But the likers are always nil. Do you know what's the problem?
Beta Was this translation helpful? Give feedback.
All reactions