Package inside package

Hi,
I have defined package MoreSpecific.swift which uses another package Definitions.swift.

In some cases I need to import only Definitions.swift, in other MoreSpecific.swift
Is it possible to import only MoreSpecific and have access Definitions.swift?

If I import and use MoreSpecific it's obvious I need Definitions...

Sorry, my English doesn't allow me explain in a way I would like to: I simply want to

import MoreSpecific

and have access to all contents of dependent packages MoreSpecific contains, rather to

import Definitions
/// and all (if any) packages MoreSpecific uses 
import MoreSpecific

If it's somehow illegal I can accept it.

You can use @_exported attribute.
Example in swift-collections.
Keep in mind that this attribute is underscored meaning it's not considered "stable". But I should also note that it has become very widespread, and you can find its use in almost any big library.
In your case you will need

@_exported import Definitions

somewhere in MoreSpecific module.

2 Likes

Great! It's I was looking for!