Skip to content

Instantly share code, notes, and snippets.

View standinga's full-sized avatar

standinga

View GitHub Profile
@standinga
standinga / AVManager.swift
Created December 12, 2020 22:34
Medium article about VideoToolbox h264 encoding and decoding
//
// AVManager.swift
// VideoToolboxArticle
//
// Created by michal on 26/10/2020.
//
import AVFoundation
class AVManager {
@standinga
standinga / ContentView.swift
Created November 30, 2020 12:14
IOS/OSX Networking updated content view
struct ContentView: View {
var body: some View {
VStack {
Button("Server") {
server?.start()
}
Spacer()
Button("Client") {
client.start()
}
@standinga
standinga / Connection.swift
Created November 30, 2020 12:08
IOS/OSX Networking updated connection
//
// PeerConnection.swift
// MultiConnect
//
// Created by michal on 29/11/2020.
//
import Foundation
import Network
@standinga
standinga / Server.swift
Last active November 30, 2020 12:06
IOS/OSX Networking updated server
//
// Server.swift
// MultiConnect
//
// Created by michal on 29/11/2020.
//
import Foundation
import Network
import UIKit
@standinga
standinga / Browser.swift
Created November 30, 2020 08:57
IOS/OSX Networking updated browser
//
// Client.swift
// MultiConnect
//
// Created by michal on 29/11/2020.
//
import Foundation
import Network
@standinga
standinga / Client.swift
Created November 30, 2020 08:56
IOS/OSX Networking initial client
//
// Client.swift
// MultiConnect
//
// Created by michal on 30/11/2020.
//
import Foundation
let client = Client()
@standinga
standinga / Server.swift
Created November 30, 2020 08:06
IOS/OSX Networking updated server
listener.newConnectionHandler = { newConnection in
log("listener.newConnectionHandler \(newConnection)")
if sharedConnection == nil {
sharedConnection = Connection(connection: newConnection)
} else {
newConnection.cancel()
}
}
@standinga
standinga / Browser.swift
Created November 30, 2020 08:03
IOS/OSX Networking updated brower
browser.browseResultsChangedHandler = { results, changes in
for result in results {
if case NWEndpoint.service = result.endpoint {
log("browser.browseResultsChangedHandler result: \(result)")
if sharedConnection == nil {
sharedConnection = Connection(endpoint: result.endpoint)
}
}
}
}
@standinga
standinga / Connection.swift
Created November 30, 2020 08:00
IOS/OSX Networking initial connection
//
// PeerConnection.swift
// MultiConnect
//
// Created by michal on 29/11/2020.
//
import Foundation
import Network
@standinga
standinga / AppDelegate.swift
Created November 30, 2020 07:00
IOS/OSX Networking AppDelegate
//
// AppDelegate.swift
// MultiConnect
//
// Created by michal on 29/11/2020.
//
import os.log
import UIKit