<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/why-some-swift-types-only-appear-when-you-import-two-modules-63wgnwpgg" -->

---
title: Why some Swift types only appear when you import two modules
description: Types like Map, PhotosPicker, and WebView don't live in SwiftUI itself but in hidden cross-import overlay modules that only load when two frameworks are...
canonical: https://daily.dev/posts/why-some-swift-types-only-appear-when-you-import-two-modules-63wgnwpgg
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Why some Swift types only appear when you import two modules | daily.dev
og:description: Types like Map, PhotosPicker, and WebView don't live in SwiftUI itself but in hidden cross-import overlay modules that only load when two frameworks are...
og:url: https://daily.dev/posts/why-some-swift-types-only-appear-when-you-import-two-modules-63wgnwpgg
og:image: https://api.daily.dev/og/posts/63wGNWpgG.png
og:image:alt: Why some Swift types only appear when you import two modules
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Why some Swift types only appear when you import two modules

**[Sarunw](https://daily.dev/sources/sarunw)** · [@sarunw](https://daily.dev/sarunw) · 5 min read · 0 upvotes · 0 comments

## Summary

Types like Map, PhotosPicker, and WebView don't live in SwiftUI itself but in hidden cross-import overlay modules that only load when two frameworks are imported together (e.g. MapKit and SwiftUI). This explains why the compiler throws 'cannot find X in scope' rather than a missing-import error when only one of the two imports is present. The piece explains how Apple structures these overlays inside the SDK, why it avoids forcing unrelated dependencies on apps, lists the most common overlay pairs shipped in the iOS 26 SDK, and gives a practical heuristic: when an expected type is missing, add the second import that matches the two frameworks it touches.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://sarunw.com/posts/swift-cross-import-overlay>

## Questions this post answers

### Why does Xcode say 'cannot find Map in scope' even though Map is documented under SwiftUI?

Map is not actually defined in SwiftUI; it lives in a cross-import overlay module named _MapKit_SwiftUI that only loads when both MapKit and SwiftUI are imported in the same file. If only one of those imports is present, the compiler never loads that hidden module, so Map is genuinely out of scope and the error reads as a missing type rather than a missing import.

_Developers debugging scope errors in swiftui code can find fixes like this one on daily.dev._

### How do I know which two frameworks to import together to fix a missing SwiftUI type like PhotosPicker or WebView?

Look at which two frameworks the type conceptually touches: PhotosPicker needs SwiftUI plus PhotosUI, and WebView needs SwiftUI plus WebKit, because these are cross-import overlay types that only appear once both modules are imported. Other pairs include MapKit with SwiftUI for Map, StoreKit with SwiftUI for SubscriptionStoreView, and SwiftData with CoreData.

_Track framework pairing quirks like swiftui cross-import overlays as you build on daily.dev._

### How can I check whether a Swift framework has cross-import overlays in the SDK?

Inspect the framework's bundle for a folder named FrameworkName.swiftcrossimport inside its Modules directory; its presence means that framework has at least one overlay. Inside it, files named OtherModule.swiftoverlay each name a paired module and, in YAML, the hidden module to load when both frameworks are imported together, such as MapKit.swiftcrossimport containing SwiftUI.swiftoverlay.

_Developers exploring sdk internals like this can surface similar deep dives via daily.dev._

## Similar posts on daily.dev

- [SwiftUI has a native WebView in iOS 26](https://daily.dev/posts/swiftui-has-a-native-webview-in-ios-26-r7vnb7uw8) · Sarunw · 1 upvotes · 1 comments
- [Advanced techniques in Swift macros](https://daily.dev/posts/advanced-techniques-in-swift-macros-arv3wzyg6) · Point-Free Pointers · 6 upvotes · 0 comments

---

Tags: [#ios](https://daily.dev/tags/ios), [#swift](https://daily.dev/tags/swift), [#swiftui](https://daily.dev/tags/swiftui), [#xcode](https://daily.dev/tags/xcode)

[View this post on daily.dev](https://daily.dev/posts/why-some-swift-types-only-appear-when-you-import-two-modules-63wgnwpgg)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Why some Swift types only appear when you import two modules","url":"https://daily.dev/posts/why-some-swift-types-only-appear-when-you-import-two-modules-63wgnwpgg","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/why-some-swift-types-only-appear-when-you-import-two-modules-63wgnwpgg"},"datePublished":"2026-09-08T20:14:08.507Z","dateModified":"2026-09-09T17:00:21.439Z","description":"Types like Map, PhotosPicker, and WebView don't live in SwiftUI itself but in hidden cross-import overlay modules that only load when two frameworks are...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/aefb66ffffca441942f0fe31936b63c2?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/aefb66ffffca441942f0fe31936b63c2?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Sarunw","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Person","name":"Sarun Wongpatcharapakorn","url":"https://daily.dev/sarunw","image":"https://avatars.githubusercontent.com/u/795368?v=4","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":20}},"commentCount":0,"discussionUrl":"https://daily.dev/posts/why-some-swift-types-only-appear-when-you-import-two-modules-63wgnwpgg","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ios,swift,swiftui,xcode","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Sarunw","item":"https://daily.dev/sources/sarunw"},{"@type":"ListItem","position":3,"name":"Why some Swift types only appear when you import two modules"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/why-some-swift-types-only-appear-when-you-import-two-modules-63wgnwpgg#faq","mainEntity":[{"@type":"Question","name":"Why does Xcode say 'cannot find Map in scope' even though Map is documented under SwiftUI?","acceptedAnswer":{"@type":"Answer","text":"Map is not actually defined in SwiftUI; it lives in a cross-import overlay module named _MapKit_SwiftUI that only loads when both MapKit and SwiftUI are imported in the same file. If only one of those imports is present, the compiler never loads that hidden module, so Map is genuinely out of scope and the error reads as a missing type rather than a missing import. Developers debugging scope errors in swiftui code can find fixes like this one on daily.dev."}},{"@type":"Question","name":"How do I know which two frameworks to import together to fix a missing SwiftUI type like PhotosPicker or WebView?","acceptedAnswer":{"@type":"Answer","text":"Look at which two frameworks the type conceptually touches: PhotosPicker needs SwiftUI plus PhotosUI, and WebView needs SwiftUI plus WebKit, because these are cross-import overlay types that only appear once both modules are imported. Other pairs include MapKit with SwiftUI for Map, StoreKit with SwiftUI for SubscriptionStoreView, and SwiftData with CoreData. Track framework pairing quirks like swiftui cross-import overlays as you build on daily.dev."}},{"@type":"Question","name":"How can I check whether a Swift framework has cross-import overlays in the SDK?","acceptedAnswer":{"@type":"Answer","text":"Inspect the framework's bundle for a folder named FrameworkName.swiftcrossimport inside its Modules directory; its presence means that framework has at least one overlay. Inside it, files named OtherModule.swiftoverlay each name a paired module and, in YAML, the hidden module to load when both frameworks are imported together, such as MapKit.swiftcrossimport containing SwiftUI.swiftoverlay. Developers exploring sdk internals like this can surface similar deep dives via daily.dev."}}]}
```

