This is a short guide on how to set up an encrypted VoIP system using Twilio and Asterisk. I was a little annoyed that just about everything these days still uses unencrypted RTP for media (though just about everyone supports SIP over TLS). So I spent a weekend looking at options, and settled on a totally overkill solution involving Twilio's secure trunking to an Asterisk PBX. While all bets are off once it hits the PSTN, at least you won't be blasting your conversations over the internet in clear text.
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 | |
extension Notification.Name { | |
static let popEverything = Notification.Name("pop_everything") | |
} | |
struct MoreTabView: View { | |
@State var triggerNext: Bool = false |
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
// Run any SwiftUI view as a Mac app. | |
import Cocoa | |
import SwiftUI | |
public func run<V: View>(view: V) { | |
let delegate = AppDelegate(view) | |
let app = NSApplication.shared | |
NSApp.setActivationPolicy(.regular) | |
app.mainMenu = app.customMenu |
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
struct Breathe: View { | |
@State var scale = false | |
@State var rotate = false | |
var body: some View { | |
ZStack { | |
Group { | |
ZStack { | |
Circle().frame(width: 80, height: 80).foregroundColor(Color(UIColor.systemBlue)).offset(y: -42) | |
Circle().frame(width: 80, height: 80).foregroundColor(Color(UIColor.systemBlue)).offset(y: 42) |
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 | |
import PlaygroundSupport | |
struct Screen: View { | |
var body: some View { | |
ScrollView { | |
HStack { | |
VStack (alignment: .leading) { | |
Text("TUESDAY, MAY 12").foregroundColor(.secondary).bold().font(.footnote) |
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
/** | |
* MacEditorTextView | |
* Copyright (c) Thiago Holanda 2020 | |
* https://twitter.com/tholanda | |
* | |
* MIT license | |
*/ | |
import Combine | |
import SwiftUI |
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
# Put this in gradle/gradle.properties | |
org.gradle.parallel=true | |
org.gradle.daemon=true | |
org.gradle.jvmargs=-Xmx4096M -Dkotlin.daemon.jvm.options\="-Xmx4096M" |
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
// I needed to fetch all the pages from a paged endpoint. | |
// In this specific case, the JSON results contained a `pagingStatus` section that provided extra information which I could use: | |
// Hiding that behind a protocol: | |
import Foundation | |
protocol PagedReturning { | |
var pagingStatus: PagingStatus { get } | |
} |
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 | |
import PlaygroundSupport | |
struct Desktop: View { | |
var body: some View { | |
ZStack { | |
// Image(uiImage: #imageLiteral(resourceName: "IMG_6281.JPG")) | |
Color(UIColor.systemBlue) | |
macOS() | |
} |