Skip to content

Instantly share code, notes, and snippets.

struct ContentView: View {
@State private var oben = false
var body: some View {
VStack {
if oben {
Text("HA").id(4)
Spacer()
} else {
Spacer()
import Foundation
enum OneOff {}
enum Sustained {}
struct KuandoCommand<Kind>: ExpressibleByArrayLiteral {
typealias ArrayLiteralElement = UInt8
private(set) var data = [ArrayLiteralElement](repeating: 0, count: 64)
//
// KeychainWrapper.swift
//
// Created by Oliver Epper on 27.05.20.
// Copyright © 2020 Oliver Epper. All rights reserved.
//
import Foundation
// This is a stripped down version of SwiftKeychainWraper
import SwiftUI
enum ButtonState {
case pressed
case notPressed
}
struct PressedModifier: ViewModifier {
@GestureState private var isPressed = false
let changeState: (ButtonState) -> Void
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this sample’s licensing information
Abstract:
A struct for accessing generic password keychain items.
*/
import Foundation
#include <iostream>
#include <vector>
using namespace std;
template <typename T>
void draw(const T& x, ostream& out, size_t position)
{
out << string(position, ' ') << x << endl;
}
void draw(const my_class_t&, ostream& out, size_t position)
{
out << string (position, ' ') << "my_class_t" << endl;
}
int main() {
document_t document;
document.reserve(5);
document.emplace_back(my_class_t());
#include <iostream>
#include <vector>
using namespace std;
template<typename T> void draw(const T& x, ostream& out, size_t position);
class object_t {
public:
template<typename T> object_t(T x) : self_(make_unique<model<T>>(move(x))) {}
import Foundation
struct Output: TextOutputStream {
mutating func write(_ string: String) {
print(string, terminator: "")
}
}
protocol Drawable {
func draw_(out: inout Output, position: Int)
#include <iostream>
#include <asio.hpp>
#include <array>
using asio::ip::tcp;
using asio::buffer;
void handle_with_future(tcp::socket& client)
{
std::future<std::size_t> bytes_written = client.async_write_some(buffer("Welcome to my nightmare\n"), asio::use_future);