<!--
{
  "availability" : [
    "iOS: 27.0.0 - 27.2.0",
    "iPadOS: 27.0.0 - 27.2.0",
    "macCatalyst: 27.0.0 - 27.2.0",
    "visionOS: 27.0.0 - 27.2.0"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/FileDocumentConfiguration/creationSource",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI25FileDocumentConfigurationV14creationSourceAA0d8CreationG0VSgvp"
  },
  "title" : "creationSource"
}
-->

# creationSource

The source associated with the button that created this document.

```
var creationSource: DocumentCreationSource? { get }
```

## Discussion

On iOS, you can specify the source via a [`NewDocumentButton`](/documentation/SwiftUI/NewDocumentButton) in
[`DocumentGroupLaunchScene`](/documentation/SwiftUI/DocumentGroupLaunchScene):

```
extension DocumentCreationSource {
    static let scanner: Self =
        DocumentCreationSource(id: "document-from-scanner")

    static let template: Self =
        DocumentCreationSource(id: "document-from-template")
}

DocumentGroupLaunchScene("Documents") {
    NewDocumentButton("Scan Document", source: .scanner)
    NewDocumentButton("New from Template", source: .template)
}
```

Use this property to determine which [`NewDocumentButton`](/documentation/SwiftUI/NewDocumentButton) triggered
the creation of the current document, allowing you to customize the UI
accordingly.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)