Skip to content

Instantly share code, notes, and snippets.

import SwiftUI
import Music
@available(macOS 12, *)
@available(iOS 13, *)
extension MusicClef: View {}
@available(macOS 12, *)
@available(iOS 13, *)
extension MusicNote: View {}
struct AnyMusicStaffViewElement: MusicStaffViewElement {
private var wrapped: MusicStaffViewElement
init(_ wrapped: MusicStaffViewElement) {
self.wrapped = wrapped
}
var unboxed: MusicStaffViewElement {
return self.wrapped
}
for x in 1...5 {
print("\(x)")
}
// Output:
// 1
// 2
// 3
// 4
// 5
VesselDeltaV dv = VesselDeltaV.Create(currentShip);
DeltaVStageInfo stageDV = dv.GetStage(currentShip.currentStage);
Debug.Log(stageDV);
extension Published: Codable where Value: Codable {
enum CodingKeys: CodingKey {
case value
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
let value = try container.decode(Value.self, forKey: .value)
self.init(initialValue: value)
}
func testTrivialPlanetPositions() {
let sun = CelestialBody(gravitationalParameter: 1, radius: 1000)
let orbit = Orbit(semiMajorAxis: 2000, eccentricity: 0, meanAnomaly: 0, inclination: 0, LAN: 0, argumentOfPeriapsis: 0, centralBody: sun)
let initialPosition = Vector3D(x: 2000, y: 0, z: 0)
XCTAssertEqual(initialPosition, orbit.cartesianPosition(atTimeFromEpoch: 0))
}
import UIKit
import PencilKit
class ViewController: UIViewController {
@IBOutlet var canvasView: PKCanvasView!
override func viewDidLoad() {
super.viewDidLoad()
HStack {
VStack(alignment: .leading) {
HStack(alignment: .center) {
SVGImageView(image: awayLogoController.logo!)
.frame(width: 1.5 * 18, height: 18, alignment: .center)
Text(game.awayTeamName)
.font(.subheadline)
.fontWeight(.semibold)
}
HStack(alignment: .center) {
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>AddShoppingListItemIntent</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<?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>INEnums</key>
<array/>
<key>INIntentDefinitionModelVersion</key>
<string>1.1</string>
<key>INIntentDefinitionNamespace</key>
<string>BBSjA5</string>