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
import Foundation
import CoreMIDI
let source = Int(CommandLine.arguments[1])!
let dest = Int(CommandLine.arguments[2])!
var owner = "uk.me.rb.thru" as CFString?
// dispose of any existing connections with the same owner
var obj = Data()
//
// WebView.swift
// Core
//
// Created by Eric Vitiello on 1/28/20.
// Copyright © 2020 Eric Vitiello. All rights reserved.
//
import SwiftUI
import Combine
@quangDecember
quangDecember / Simple-browser-WKWebView-UIKit.md
Last active November 2, 2023 08:45
Creating Simple Web Browser with WKWebView & UINavigationController

WKWebView was first introduced on iOS 8. With Apple finally release a deadline for all apps to migrate away from UIWebView, this series and this post is here to help you explore the features of WKWebView. In this blog post you will create a simple web browser with some basic features such as displaying content, back and forward.

Setup Previews for your project

One of the most interesting things coming out with Xcode 11 is SwiftUI's PreviewProvider, which provides a way to preview the UI during development instantly on multiple devices, multiple settings at the same time.

To preview UIViewController and UIView, you need to download previewing code from NSHipster

Since we are making this browser with a navigation bar, our main UIViewController needs to be embedded inside a UINavigationController. Therefore the previewing code would be like this:

import UIKit
import AudioToolbox
enum AlertTones: SystemSoundID {
case MailSent = 1001
case MailReceived = 1000
case receivedMessage = 1003
case sendMessage = 1004
case Tock = 1105
@alwarren
alwarren / colors_android_api_28.xml
Last active November 13, 2021 17:19
Android Colors
<?xml version="1.0" encoding="utf-8"?>
<!--
/* //device/apps/common/assets/res/any/colors.xml
**
** Copyright 2006, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
@Alexander-Ignition
Alexander-Ignition / SystemSound.swift
Created November 27, 2018 11:52
iOS system sound
import AudioToolbox
/// System sound errors.
///
/// Errors returned from the SystemSound portion of the API.
enum SystemSoundError: Error {
case unspecified
case clientTimedOut
case exceededMaximumDuration
case unknown(OSStatus)
@martinpi
martinpi / AutocompleteView.swift
Created November 5, 2018 13:41
An autocomplete popup for text entry. Ported to Swift from this example: https://github.com/danjonweb/NCRAutocompleteTextView
//
// AutocompleteView.swift
//
// Originally created by Daniel Weber on 9/28/14.
// Copyright (c) 2014 Null Creature. All rights reserved.
// Ported to Swift by Martin Pichlmair 2018
//
import Cocoa
@martinpi
martinpi / SyntaxHighlighter.swift
Created October 13, 2018 14:27
A simple Swift 4.0 class for syntax highlighting in an NSTextView
//
// SyntaxHighlighter.swift
// CardsCardsCards
//
// Created by Martin Pichlmair on 12/10/2018.
//
// Based on https://raw.githubusercontent.com/kuyawa/Macaw/master/Macaw/Macaw.swift
import Cocoa
@sventschui
sventschui / ViewControler.swift
Last active April 4, 2023 11:08
JS based download in WKWebView
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if (openInDocumentPreview(navigationAction.request.url!)) {
decisionHandler(.cancel)
// TODO: Add more supported mime-types for missing content-disposition headers
webView.evaluateJavaScript("""
(async function download() {
const url = '\(navigationAction.request.url!.absoluteString)';
try {
@zawzaww
zawzaww / twrp-recovery-flags.mk
Last active May 19, 2024 10:16
Makefile Flags for Compiling TWRP
# USEFUL TWRP RECOVERY FLAGS
# by ZawZaw @XDA-Developers
# Thanks to : @xda-developers for helps
# Add EXT4 support
TARGET_USERIMAGES_USE_EXT4 := true
# Disable/enable SELinux. Only suggested when you want to enable SELinux support
TWHAVE_SELINUX := true