Thanks much, Alex.<br><br>But how do you physically partition the namespace within a module, if not by sub-folders?<br><br>I am not sure whether the following example is, by definition, of a submodule that one could import by writing "import Cacao.StyleKit":<br><br>Https://github.com/PureSwift/Cacao/tree/master/Sources/Cacao/StyleKit<br><br>Sent from ProtonMail mobile<br><br><br><br>-------- Original Message --------<br>On 13.09.2017, 10:23, Alex Blewitt < alblue@apple.com> wrote:<blockquote class="protonmail_quote"><br><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
No, submodules in Swift bear little relation to sub packages in Java. It's really just a way of partitioning the namespace within a single module. Nor is there any relation between the path and the name of the module either.
<div class="">
<br class="">
</div>
<div class="">
Alex
<br class="">
<div>
<br class="">
<blockquote type="cite" class="">
<div class="">
On 12 Sep 2017, at 22:41, blaster_in_black via swift-users <
<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>> wrote:
</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">
Hi,
<br class="">
</div>
<div class="">
<br class="">
</div>
<div class="">
I am beginning with Swift 4 (coming from the Java world) but I do not have yet a Swift development environment to experiment with. Therefore my question(s) might sound a bit silly. Unfortunately, I haven't been able to answer them by reading the online Language Guide.
<br class="">
</div>
<div class="">
<br class="">
</div>
<div class="">
1) What makes a submodule? I can see online examples about how to import them, but not how to create one or any other further details about them. Are they like Java packages inside a jar? Do their hierarchical name (
<b class="">prefix1.prefix2. ... .submodulename</b>) reflect a path tree on the filesystem (/
<b class="">prefix1/prefix2. ... /submodulename</b>), just as it happens with Java packages?
<br class="">
</div>
<div class="">
2) Can two different submodules within a single module export two different classes under a single class name? Like
<b class=""> module.submodule1.MyType</b> and
<b class="">module.submodule2.myType</b>.
<br class="">
</div>
<div class="">
<br class="">
</div>
<div class="">
Thanks in advance.
<br class="">
</div>
<div class="">
<br class="">
</div>
<div class="">
David
<br class="">
</div>
<div class="">
<br class="">
</div>_______________________________________________
<br class="">swift-users mailing list
<br class="">
<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>
<br class="">https://lists.swift.org/mailman/listinfo/swift-users
<br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html></div>