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 {| let excludedActivityTypes = [ | |
| UIActivity.ActivityType.print, | |
| UIActivity.ActivityType.openInIBooks, | |
| UIActivity.ActivityType.copyToPasteboard, | |
| UIActivity.ActivityType.addToReadingList, | |
| UIActivity.ActivityType.assignToContact, | |
| UIActivity.ActivityType.copyToPasteboard, | |
| UIActivity.ActivityType.mail, | |
| UIActivity.ActivityType.markupAsPDF, | |
| UIActivity.ActivityType.postToFacebook, |
| // | |
| // FirestoreMonitoring.swift | |
| // Monitor | |
| // | |
| // Created by nori on 2020/08/19. | |
| // Copyright © 2020 1amageek. All rights reserved. | |
| // | |
| import Foundation | |
| import FirebaseFirestore |
| import UIKit | |
| /// A validation rule for text input. | |
| public enum TextValidationRule { | |
| /// Any input is valid, including an empty string. | |
| case noRestriction | |
| /// The input must not be empty. | |
| case nonEmpty | |
| /// The enitre input must match a regular expression. A matching substring is not enough. | |
| case regularExpression(NSRegularExpression) |
| application: you-app-name-here | |
| version: 1 | |
| runtime: python | |
| api_version: 1 | |
| default_expiration: "30d" | |
| handlers: | |
| - url: /(.*\.(appcache|manifest)) | |
| mime_type: text/cache-manifest |