This file contains 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
dobuild() { | |
export CC="$(xcrun -find -sdk ${SDK} cc)" | |
# export CXX="$(xcrun -find -sdk ${SDK} cxx)" | |
export CPP="$(xcrun -find -sdk ${SDK} cpp)" | |
export CFLAGS="${HOST_FLAGS} ${OPT_FLAGS}" | |
export CXXFLAGS="${HOST_FLAGS} ${OPT_FLAGS}" | |
export LDFLAGS="${HOST_FLAGS}" | |
./configure --host=${CHOST} --prefix=${PREFIX} --enable-openssl --with-openssl-dir="../openssl/" | |
make | |
} |
This file contains 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 CoreBluetooth | |
class Test: NSObject, CBPeripheralManagerDelegate { | |
func peripheralManager(_ peripheral: CBPeripheralManager, didAdd service: CBService, error: Error?) { | |
let peripheral: CBPeripheral | |
// So what I would like is something like this | |
// But this does not work :( | |
if #available(iOS 15, *) { |
This file contains 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
public typealias AccessTokenPublisher = AnyPublisher<String, Error> | |
func fetchAuthorizedURLRequest(_ urlRequest: URLRequest, | |
accessToken: AccessTokenPublisher) -> AnyPublisher<Data, Error> { | |
accessToken | |
.flatMap { (accessToken: String) -> AnyPublisher<(data: Data, response: URLResponse), Error> in | |
URLSession.shared.dataTaskPublisher( | |
for: urlRequest.requestWithToken(accessToken) |
This file contains 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
/*: | |
### Controlling your Future | |
For my little Combine Project, I need to control acccess to a critical | |
section. (For those following along it won't be hard to guess: I don't want the accessToken mechanism to be accessed from two places). | |
So, building on an existing [sample](https://medium.com/swiftcairo/avoiding-race-conditions-in-swift-9ccef0ec0b26), I built | |
something in combine. |
This file contains 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
// | |
// AppAuthenticator.swift | |
// HomeOS API Demo | |
// | |
// Created by Alexander v. Below on 10.02.21. | |
// | |
import AppAuth | |
import Combine |
This file contains 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 TeamMemberView: View { | |
var columns: [GridItem] = | |
Array(repeating: .init(.flexible()), count: 2) | |
var body: some View { | |
ScrollView { | |
LazyVGrid(columns: columns, alignment: .leading) { | |
Text("Name:") | |
Text("Anne Applebaum") | |
Text("Contact:") | |
Text("+1-415-555-1111, [email protected]").lineLimit(0) |
This file contains 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
public func behindThePublisher(url: URL) -> AnyPublisher<NSAttributedString, Never> { | |
/// … | |
} | |
class ActionViewController: UIViewController { | |
@IBOutlet weak var textView: UITextView! | |
var cancellables = Set<AnyCancellable>() | |
@Published var displayText: NSAttributedString = NSAttributedString() |
This file contains 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
// Do you like my endless iterator? | |
struct EndlessIterator { | |
var baseIterator: String.Iterator? | |
var start: String | |
init(_ start: String) { | |
self.start = start | |
} |
This file contains 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 TestView: View { | |
@State var foo = "faz" | |
init() { | |
foo = "bar" | |
debugPrint(foo) // prints "faz" | |
} | |
var body: some View { Text(foo) } |
This file contains 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
//: A UIKit based Playground for presenting user interface | |
// | |
// QuizList.swift | |
// QuizList | |
// | |
// Created by Alexander v. Below on 09.06.19. | |
// Copyright © 2019 None. All rights reserved. | |
// |
NewerOlder