This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import SwiftUI | |
| struct Application: Identifiable { | |
| enum Icon { | |
| case url(URL) | |
| case systemImage(String) | |
| } | |
| let id: UUID = .init() | |
| let name: String |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Works. | |
| extension VW { | |
| public static func buildBlock<Content: DynamicViewContent>(_ content: Content) -> some View where Content.Data: RandomAccessCollection, Content.Data.Element: Identifiable { | |
| ViewBuilder.buildBlock(VStack { ForEach(content.data) { _ in Text("Test") } }) | |
| } | |
| } | |
| // Crashes | |
| extension VW { | |
| public static func buildBlock<Content: DynamicViewContent>(_ content: Content) -> some View where Content.Data: RandomAccessCollection, Content.Data.Element: Identifiable { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <style type="text/css"> | |
| body { | |
| width: 100%; | |
| height: 100%; | |
| position: absolute; | |
| background-color: black; | |
| top: 0%; | |
| left: 0%; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import LinkKit | |
| import SwiftUI | |
| struct PlaidViewPresenter: UIViewControllerRepresentable { | |
| @Binding var isPresented: Bool | |
| var configuration: LinkPublicKeyConfiguration | |
| var exitCallback: ((LinkExit) -> Void)? | |
| var successCallback: ((LinkSuccess) -> Void)? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * An object with different URLs to fetch | |
| * @param {Object} ORIGINS | |
| */ | |
| const ORIGINS = { | |
| "darknews.ericlewis.workers.dev": "news.ycombinator.com" | |
| } | |
| async function handleRequest(request) { | |
| const url = new URL(request.url) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // StoreKit+Combine.swift | |
| // | |
| // Created by Eric Lewis on 12/11/20. | |
| // | |
| import StoreKit | |
| import Combine | |
| extension SKCloudServiceController { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func fetchOrder(type: FeedType) { | |
| DispatchQueue.global(qos: .userInitiated).async { | |
| let context = PersistenceController.shared.container.newBackgroundContext() | |
| self.orderCancellable = self.ref.child(type.hackerNewsEndpoint).observeSingleEventPublisher(of: .value) | |
| .compactMap { | |
| $0.value as? [Int] | |
| } | |
| .flatMap { orders -> Publishers.Sequence<[Int], Never> in | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension DatabaseReference { | |
| func observeSingleEventPublisher(of eventType: DataEventType) -> AnyPublisher<DataSnapshot, Error> { | |
| Future<DataSnapshot, Error> { [weak self] completion in | |
| self?.observeSingleEvent(of: eventType) { | |
| completion(.success($0)) | |
| } | |
| } | |
| .eraseToAnyPublisher() | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // | |
| // LPMetadataProvider+Combine.swift | |
| // Hacker | |
| // | |
| // Created by Eric Lewis on 9/22/20. | |
| // | |
| import SwiftUI | |
| import LinkPresentation | |
| import Combine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import LinkPresentation | |
| import Combine | |
| extension LPMetadataProvider { | |
| func startFetchingMetadataPublisher(for url: URL) -> AnyPublisher<LPLinkMetadata?, Error> { | |
| Future<LPLinkMetadata?, Error> { completion in | |
| self.startFetchingMetadata(for: url) { meta, error in | |
| guard let error = error else { | |
| return completion(.success(meta)) | |
| } |