Something went wrong. Try again.
A slopfork of Sam Henri Gold's Twitter client, reskinned like Tweetie 2 / Twitter for iPhone circa 2012. Personal use.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738import Modelsimport SwiftUIimport UIKit
/// A preview for a profile known only by its handle, such as a mention: a placeholder card until the account is/// found, from memory, the on-disk cache, then the network.struct LoadingProfilePreview: View { let screenName: String @State private var user: User?
var body: some View { ProfilePreviewCard(user: user ?? ProfileLookup.remembered(screenName), screenName: screenName) .limitsImageHeadroom() .task(id: screenName) { if user == nil, let stored = await ProfileLookup.stored(screenName) { user = stored } if let fresh = await ProfileLookup.fetch(screenName) { withAnimation(.snappy) { user = fresh } } } }}
/// Hosts ``LoadingProfilePreview`` as a context menu preview, sized to the card as it loads.final class ProfilePreviewController: UIHostingController<LoadingProfilePreview> { init(screenName: String) { super.init(rootView: LoadingProfilePreview(screenName: screenName)) sizingOptions = .preferredContentSize view.backgroundColor = UIColor(resource: .twitterBackground) }
@available(*, unavailable) @MainActor required dynamic init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }}