Add a Skylark rule to build Swift modules.

* Adds a swift_library rule that produces a (.a, .swiftmodule) pair. It can handle dependencies between modules and can be used as a dependency of objc_binary.
* Does not work with Objective-C yet.

--
MOS_MIGRATED_REVID=120578875
diff --git a/examples/BUILD b/examples/BUILD
index 8bfbc19..781c81a 100644
--- a/examples/BUILD
+++ b/examples/BUILD
@@ -11,5 +11,6 @@
         "//examples/py:srcs",
         "//examples/py_native:srcs",
         "//examples/shell:srcs",
+        "//examples/swift:srcs",
     ],
 )
diff --git a/examples/swift/BUILD b/examples/swift/BUILD
new file mode 100644
index 0000000..e2cbb19
--- /dev/null
+++ b/examples/swift/BUILD
@@ -0,0 +1,19 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])  # Apache 2.0
+
+load("//tools/build_defs/apple:swift.bzl", "swift_library")
+
+swift_library(
+    name = "swift_lib",
+    srcs = glob(["*.swift"]),
+    deps = ["//examples/swift/BarLib"],
+)
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]) + [
+        "//examples/swift/BarLib:srcs",
+    ],
+    visibility = ["//examples:__pkg__"],
+)
diff --git a/examples/swift/BarLib/BUILD b/examples/swift/BarLib/BUILD
new file mode 100644
index 0000000..d575a87
--- /dev/null
+++ b/examples/swift/BarLib/BUILD
@@ -0,0 +1,15 @@
+package(default_visibility = ["//visibility:public"])
+
+licenses(["notice"])  # Apache 2.0
+
+load("//tools/build_defs/apple:swift.bzl", "swift_library")
+
+swift_library(
+    name = "BarLib",
+    srcs = ["mul.swift"],
+)
+
+filegroup(
+    name = "srcs",
+    srcs = glob(["**"]),
+)
diff --git a/examples/swift/BarLib/mul.swift b/examples/swift/BarLib/mul.swift
new file mode 100644
index 0000000..1f1df40
--- /dev/null
+++ b/examples/swift/BarLib/mul.swift
@@ -0,0 +1,8 @@
+/// Class used to multiply stuff.
+public class Multiplier {
+  public init() {}
+
+  public func multiply(a: Int, _ b: Int) -> Int {
+      return a * b
+  }
+}
diff --git a/examples/swift/constants.swift b/examples/swift/constants.swift
new file mode 100644
index 0000000..6c16d34
--- /dev/null
+++ b/examples/swift/constants.swift
@@ -0,0 +1,4 @@
+class Constants {
+  static var x = 2
+  static var y = 3
+}
\ No newline at end of file
diff --git a/examples/swift/foo.swift b/examples/swift/foo.swift
new file mode 100644
index 0000000..067c673
--- /dev/null
+++ b/examples/swift/foo.swift
@@ -0,0 +1,9 @@
+import class BarLib.Multiplier
+
+public class Foo {
+  public init() {}
+
+  public func multiply() -> Int {
+    return Multiplier().multiply(Constants.x, Constants.y)
+  }
+}