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
// | |
// ContentView.swift | |
// NavigationTest | |
// | |
// Created by Craig Hockenberry on 4/16/24. | |
// | |
import SwiftUI | |
struct OddView: View { |
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
// | |
// ContentView.swift | |
// BindableOptional | |
// | |
// Created by Craig Hockenberry on 4/12/24. | |
// | |
import SwiftUI | |
@Observable |
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
// | |
// ContentView.swift | |
// ProtocolBinding | |
// | |
// Created by Craig Hockenberry on 4/10/24. | |
// | |
import SwiftUI | |
protocol ShapeProtocol { |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>NSPrivacyAccessedAPITypes</key> | |
<array> | |
<dict> | |
<key>NSPrivacyAccessedAPITypeReasons</key> | |
<array> | |
<string>CA92.1</string> |
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
#!/bin/sh | |
if [ ! -z "$*" ]; then | |
echo "this is ~/bin/df, use /bin/df" | |
exit 1 | |
fi | |
protect=`mount | grep -v "read-only" | grep "protect" | cut -f 3 -w` | |
nosuid=`mount | grep -v "read-only" | grep "nosuid" | cut -f 3 -w` |
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
extension NetService { | |
var url: URL? { | |
get { | |
if self.port != -1 { | |
var urlComponents = URLComponents() | |
urlComponents.scheme = "http" | |
if let hostName = self.hostName { | |
urlComponents.host = hostName.lowercased() | |
} |
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
We have this in SwiftUI: | |
#if targetEnvironment(simulator) | |
Yet it’s rarely useful, because SwiftUI code that’s being used in a preview is being run in a simulator. | |
The distinction that developers need is whether the code is being used in a preview or in the Simulator app. | |
The root of the problem is that View data is kept in two separate locations: |
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
// | |
// ContentView.swift | |
// PanelTest | |
// | |
// Created by Craig Hockenberry on 8/11/23. | |
// | |
import SwiftUI | |
struct ContentView: View { |
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
#!/bin/sh | |
pids=`ps axo pid,command | grep CoreSimulator | grep -v "grep CoreSimulator" | cut -c 1-5` | |
if [ "$1" = "go" ]; then | |
kill -9 $pids | |
elif [ "$1" = "echo" ]; then | |
echo $pids | |
else | |
pid_param=`echo $pids | tr -s ' ' ','` |
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 Foundation | |
Task<Void,Never> { | |
do { | |
if let url = URL(string: "http://localhost:22") { | |
let (_, response) = try await URLSession.shared.data(from: url) | |
if let response = response as? HTTPURLResponse { | |
print(response.statusCode) | |
} | |
else { |
NewerOlder