Skip to content

Instantly share code, notes, and snippets.

View BAProductions's full-sized avatar
💭
Making Test Build With Imported Repo

DJABHipHop BAProductions

💭
Making Test Build With Imported Repo
View GitHub Profile
@BAProductions
BAProductions / SwiftUIWebView.swift
Last active April 4, 2023 12:41
SwiftUI Wrapper WKWebView works, But still think it can be better optmize if anyone wants optmize better feel free to do so.
//
// webview.swift
// BR
//
// Created by BAproductions on 8/12/22.
//
import SwiftUI
import WebKit
import Combine
import SwiftUI
struct ContentView: View {
let svgURL = URL(string: "URL TO YOUR SVG")!
var body: some View {
WebView(url: svgURL)
}
}
@boraseoksoon
boraseoksoon / MonacoWebView.swift
Created March 5, 2023 08:40
Load Monaco editor in a single html file for MacOS SwiftUI
import SwiftUI
import WebKit
@main
struct MonacoApp: App {
let codeSnippet = """
var body: some Scene {
WindowGroup {
EditorView(content: codeSnippet, language: "swift", theme: "vs-dark")
}
@moto0000
moto0000 / AsyncImage.swift
Last active April 13, 2023 14:07
Mockable SwiftUI.AsyncImage
import SwiftUI
public struct AsyncImage<Content>: View where Content: View {
private var content: (ImageProvider) -> _ConditionalContent<
SwiftUI.AsyncImage<Content>, Content
>
@Environment(\.imageProvider) var imageProvider
public init(
@zentrope
zentrope / RichTextEditor.swift
Created October 2, 2022 00:00
NSTextView wrapper for SwiftUI
import Combine
import SwiftUI
struct RichTextEditor: NSViewRepresentable {
@Binding var attributedText: NSAttributedString
@Binding var showInspector: Bool
var activity: PassthroughSubject<Date, Never>
//
// WebView.swift
// OPass
//
// Created by secminhr on 2022/6/23.
// 2022 OPass.
//
import SwiftUI
import Combine
@hkitago
hkitago / ContentView.swift
Last active March 30, 2023 17:26
WKWebViewTemplate to display HTML with JavaScript
//
// ContentView.swift
// WKWebViewTemplate
//
// Created by Hiroyuki KITAGO on 2022/01/26.
//
import SwiftUI
import WebKit
struct ContentView: View {
//
// VKLoginWebView.swift
// SwiftUI-Course
//
// Created by andrey.antropov on 14.10.2021.
//
import SwiftUI
import WebKit
@jranson
jranson / packet.swift
Created December 21, 2020 19:17
set MIDIPacket data from an array
//
// packet.swift
//
// As CoreMIDI/MIDIPacket exposes the 'data' member as a Tuple in Swift, this
// solution accepts a varying size [UInt8] and returns the corresponding tuple.
// Usage is as follows:
//
// packet.data = packetDataFromBytes(data: myArray)
//
// Created by James Ranson on 12/19/20.
@xmarkmaxwell
xmarkmaxwell / BrowserView.swift
Last active March 30, 2023 17:24
A WebView Browser for SwiftUI (single file gist)
//
// WebViewUI.swift
// Styling
//
// Created by Mark C. Maxwell on The New Lux
// Copyright © 2020. All rights reserved.
// Source: https://github.com/kylehickinson/SwiftUI-WebView
import Combine
import SwiftUI