---
title: Transient()
framework: swiftdata
role: symbol
role_heading: Macro
path: swiftdata/transient()
---

# Transient()

Tells SwiftData not to persist the annotated property when managing the owning class.

## Declaration

```swift
@attached(peer) macro Transient()
```

## Mentioned in

Preserving your app’s model data across launches

## Overview

Overview If your model class has one or more stored properties that you want to omit from writes to the persistent storage, annotate each of those properties with the @Transient macro. note: By default, SwiftData considers any computed properties to be transient. You don’t need to explicitly annotate those properties. @Model class RemoteImage {     var sourceURL: URL     var data: Data          @Transient     var isDownloading = false          init(sourceURL: URL, data: Data = Data(), isDownloading: Bool) {         self.sourceURL = sourceURL         self.data = data         self.isDownloading = isDownloading     } } Unless the type of the annotated property is an optional, the @Transient macro requires you to provide a default value. This constraint enables SwiftData to successfully materialize instances of the enclosing model class when running fetches.

## See Also

### Model definition

- [Model()](swiftdata/model().md)
- [Attribute(_:originalName:hashModifier:)](swiftdata/attribute(_:originalname:hashmodifier:).md)
- [Unique(_:)](swiftdata/unique(_:).md)
- [Index(_:)](swiftdata/index(_:)-74ia2.md)
- [Index(_:)](swiftdata/index(_:)-7d4z0.md)
- [Defining data relationships with enumerations and model classes](swiftdata/defining-data-relationships-with-enumerations-and-model-classes.md)
- [Relationship(_:deleteRule:minimumModelCount:maximumModelCount:originalName:inverse:hashModifier:)](swiftdata/relationship(_:deleterule:minimummodelcount:maximummodelcount:originalname:inverse:hashmodifier:).md)
