TL;DR: Use var
for properties in struct
as long as it serves as a nominal tuple. In most cases, there is no obvious benefit to using let
for struct
properties.
Let's start with a simple example:
struct MyStruct {
import * as logger from 'firebase-functions/logger' | |
import { defineSecret } from 'firebase-functions/params' | |
import { HttpsError, onRequest } from 'firebase-functions/v2/https' | |
const secretKey = defineSecret('convertMapSecretKey') | |
const googleMapsApiKey = defineSecret('convertMapGoogleMapsApiKey') | |
async function getFtidFromShortUrl(shortUrl: string): Promise<string> { | |
const response = await fetch(shortUrl, { | |
method: 'GET', |
import SwiftUI | |
import MapKit | |
struct MonotoneMap: View { | |
@State var position = MapCameraPosition.region( | |
MKCoordinateRegion( | |
center: CLLocationCoordinate2DMake(35.685175, 139.7528), | |
span: MKCoordinateSpan(latitudeDelta: 0.03, longitudeDelta: 0.03) | |
) | |
) |
import SwiftUI | |
struct ContentView: View { | |
var body: some View { | |
VStack { | |
TextSampleView(style: .foreground) | |
TextSampleView(style: .mint) | |
TextSampleView(style: linearGradient) | |
} | |
.font(.largeTitle) |
import SwiftUI | |
struct ContentView: View { | |
@State var rating: Double = 0 | |
var body: some View { | |
HStack(spacing: 18) { | |
Button( | |
action: { withAnimation { rating -= 1 } }, | |
label: { Image(systemName: "minus.circle") } |
// Dump all NSApplication’s class methods | |
let dump = NSApplication.perform(NSSelectorFromString("fp_methodDescription")).takeUnretainedValue() as? String | |
// Dump all NSApplication’s instance methods | |
let dump = NSApp.perform(NSSelectorFromString("fp_methodDescription")).takeUnretainedValue() as? String | |
// or | |
print(NSApplication.value(forKey: "fp_methodDescription")) | |
print(NSApp.value(forKey: "fp_methodDescription")) |
#include <M5StickC.h> | |
#include <WiFi.h> | |
#include <ssl_client.h> | |
#include <HTTPClient.h> | |
#define PIN_SW 26 | |
const char* ssid = "ssid"; | |
const char* password = "pass"; | |
const char* WEBHOOK_URL = "url"; |
withAnimation(.bouncy(duration: 0.5, extraBounce: 0.5)) { | |
isDraggingRight = false | |
} |
import Combine | |
import SwiftUI | |
// MARK: - Demo View | |
/// A demo screen showcasing the `RandomMetaball2DView`. | |
/// | |
/// This screen expands to fill the entire safe area. | |
struct RandomMetaballDemoScreen: View { | |
var body: some View { |