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 | |
struct ContentView: View { | |
@State var selected = "Foo" | |
var body: some View { | |
SegmentedControl(options: ["Foo", "Bar", "Baz"], selectedOption: $selected) { label in | |
Text(label) | |
} | |
} |
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
// How to use it: | |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
RecordScreenButton() | |
} | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
typedef struct Point { | |
int x; | |
int y; | |
} Point; | |
int main() { | |
int count = 2; |
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 | |
import Foundation | |
struct MarkdownView: View { | |
var body: some View { | |
Text(try! AttributedString(markdown: "This is a **basic** _string_. Italic bits are red. All the **bold** bits are _coloured_ **green**! And [this is a link!](https://q42.nl/).", customBoldColor: .green, customItalicColor: .red)) | |
.font(.title) | |
} | |
} |
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
// | |
// ScrollViewWrapper.swift | |
// | |
// Created by Mathijs Bernson on 10/03/2022. | |
// Copyright © 2022 Q42. All rights reserved. | |
// | |
import SwiftUI | |
import UIKit |
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 Foundation | |
struct MarkdownView: View { | |
var body: some View { | |
Text(try! AttributedString(markdown: "This is a **basic** _string_.", customBoldColor: .green)) | |
.font(.title) | |
} | |
} |
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 UIKit | |
extension CGAffineTransform { | |
static func flipVertical(height: CGFloat) -> Self { | |
CGAffineTransform(a: 1, b: 0, c: 0, d: -1, tx: 0, ty: height) | |
} | |
} |
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
// | |
// MailComposeView.swift | |
// | |
// Created by Mathijs Bernson on 08/03/2022. | |
// Copyright © 2022 Q42. All rights reserved. | |
// | |
import SwiftUI | |
import MessageUI |
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 | |
public struct Q42: View { | |
private let bounds = CGRect(x: 0, y: 0, width: 333, height: 500) | |
public init() {} | |
private var balloon: some Shape { | |
Fit(path: Path("166.6 500 m 214.8 345.7 273 319 316.9 232.9 c 371.2 126.5 282.5 0 166.6 0 c 50.7 0 -37.9 126.5 16.4 232.9 c 60.2 319 118.4 345.7 166.6 500 c h")!, bounds: bounds) | |
} |
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
from random import randint | |
# Gooi de dobbelsteen | |
answer = randint(1, 6) | |
while True: | |
guess = int(input('Raad een getal tussen 1 en 6: ')) | |
if guess == answer: | |
print("Dat was het juiste antwoord!") | |
break |