Framework loading from outside of App package when running on simulator

When embedding a framework in an iOS application I noticed some differing behavior when running on an actual device and simulator which I couldn't find an explanation for anywhere in the documentation. The embedded frameworks are loaded from outside (adjacent) to the app package when running on simulator whereas they are loaded from within the app package, within the Frameworks directory when running on an actual device.

Here's a link to an example project which logs the path at which the dylib within the framework is loaded: https://github.com/R4N/simulatorLoadFrameworkExample

The sample outputs are as follows:

On simulator:

/Users/<username>/Library/Developer/Xcode/DerivedData/simulatorLoadFrameworkExample-gmxyfcrvpmdfgqepjbbysebvysmh/Build/Products/Debug-iphonesimulator/libsimple.dylib

On device:

/private/var/containers/Bundle/Application/9D22C144-848A-4E40-B5B3-707B1CFD3151/simulatorLoadFrameworkExample.app/Frameworks/libsimple.dylib

Is this the correct/expected behavior and if so is there any documentation which references this?

These are the documentation pages which I've reviewed so far trying to find an answer/explanation:

https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/CreationGuidelines.html

https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1

https://developer.apple.com/library/archive/technotes/tn2435/_index.html

same issue here.

i can also add that this behaviour happens only when running the app via Xcode, while the embedded framework is correctly loaded from within the app bundle if the app is launched manually from "inside" the simulator.

is this a bug or a feature? in case it's a feature, how to disable it and let embedded frameworks always be loaded from within the app bundle?

Framework loading from outside of App package when running on simulator
 
 
Q