# \#best-practices

**URL:** https://forums.swift.org/tag/best-practices/328.md

[Latest](https://forums.swift.org/latest.md) · [Categories](https://forums.swift.org/categories.md) · [Tags](https://forums.swift.org/tags.md)

---

## [Single file versus multiple files in a Swift package](https://forums.swift.org/t/single-file-versus-multiple-files-in-a-swift-package/81126)

<div class="topic-metadata">

**Author:** [@wigging](https://forums.swift.org/u/wigging)\
**Replies:** 9\
**Last updated:** [July 21, 2025, 3:38pm UTC](https://forums.swift.org/t/single-file-versus-multiple-files-in-a-swift-package/81126 "2025-07-21T15:38:33Z")

</div>

I have a Swift package that does various numerical calculations. All of the algebra related code is in an Algebra.swift file which contains a protocol and extensions that conform to the protocol. This file has gotten ver…

---

## [Polymorphism and protocol in swift library](https://forums.swift.org/t/polymorphism-and-protocol-in-swift-library/66921)

<div class="topic-metadata">

**Author:** [@la-pieuvre](https://forums.swift.org/u/la-pieuvre)\
**Replies:** 7\
**Last updated:** [August 24, 2023, 4:55pm UTC](https://forums.swift.org/t/polymorphism-and-protocol-in-swift-library/66921 "2023-08-24T16:55:59Z")

</div>

Looking into many swift library, i found that many types that have a common interface are usually not implementing a common protocol. For exemple in Swift-Syntax, ClassDeclSyntax and StructDeclSyntax are basically identi…

---

## [Using Lazy var downsides](https://forums.swift.org/t/using-lazy-var-downsides/49221)

<div class="topic-metadata">

**Author:** [@RedMak](https://forums.swift.org/u/RedMak)\
**Replies:** 2\
**Last updated:** [June 3, 2021, 12:18pm UTC](https://forums.swift.org/t/using-lazy-var-downsides/49221 "2021-06-03T12:18:19Z")

</div>

Hi all, im here to ask a simple question :slight\_smile: : is there any downsides of using lazy var like in compilation time or runtime speed .. ? In my project i really like to have everything related to a var (speci…

---

## [“Three way optionals” / Distinguishing unknown and absent values](https://forums.swift.org/t/three-way-optionals-distinguishing-unknown-and-absent-values/45423)

<div class="topic-metadata">

**Author:** [@kibigo](https://forums.swift.org/u/kibigo)\
**Replies:** 13\
**Last updated:** [March 11, 2021, 6:09pm UTC](https://forums.swift.org/t/three-way-optionals-distinguishing-unknown-and-absent-values/45423 "2021-03-11T18:09:32Z")

</div>

In some cases, it is important to distinguish between “unknown value” (because it has not been allocated; because it is not determinable from the given information) and “absent” (known not to be present), two cases which…

---

## [Vapor 4 App / Tests sub-directory structure & style guide](https://forums.swift.org/t/vapor-4-app-tests-sub-directory-structure-style-guide/40654)

<div class="topic-metadata">

**Author:** [@Jeehut](https://forums.swift.org/u/Jeehut)\
**Replies:** 2\
**Last updated:** [September 26, 2020, 2:12pm UTC](https://forums.swift.org/t/vapor-4-app-tests-sub-directory-structure-style-guide/40654 "2020-09-26T14:12:34Z")

</div>

I just started using Vapor 4 seriously and noticed that the style guide which was part of the Vapor 3 documentation is no longer part of the Vapor 4 docs. Having a background in Ruby on Rails myself, I really like how su…

---

## [Using jargon in the name of the @derivative attribute](https://forums.swift.org/t/using-jargon-in-the-name-of-the-derivative-attribute/33358)

<div class="topic-metadata">

**Author:** [@Tino](https://forums.swift.org/u/Tino)\
**Replies:** 74\
**Last updated:** [February 21, 2020, 11:39am UTC](https://forums.swift.org/t/using-jargon-in-the-name-of-the-derivative-attribute/33358 "2020-02-21T11:39:10Z")

</div>

This is a spinoff from another thread. Therefor, it's focused on a specific case ("wrt"), but the topic itself might be more general. So, without further ado :slight\_smile:: That is fine — but don't you see a differen…
