summaryrefslogtreecommitdiff
path: root/swift/README.md
blob: 324a0fd151fd87198518c51607d639b7da3df3b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# Building Ice for Swift

This file describes how to build Ice for Swift from source and how to test the
resulting build.

* [Build Requirements](#build-requirements)
  * [Operating Systems](#operating-systems)
  * [Slice to Swift Compiler](#slice-to-swift-compiler)
  * [Swift Version](#swift-version)
* [Building Ice for Swift](#building-ice-for-swift)

## Swift Build Requirements

### Operating Systems

Ice for Swift builds and runs properly on macOS and is fully supported on
the platforms listed on the [supported platforms][2] page.

### Slice to Swift Compiler

You need the Slice to Swift compiler to build Ice for Swift and also to use
Ice for Swift. The Slice to Swift compiler (`slice2swift`) is a command-line tool
written in C++. You can build the Slice to Swift compiler from source, or
alternatively you can install an Ice [binary distribution][1] that includes
this compiler.

### Swift Version

Ice for Swift requires Swift 5 or later.

## Building Ice for Swift

The build system requires the Slice to Swift and the Slice to C++
compilers. If you have not installed a binary distribution that provides
these command-line tools, refer to the [C++ build instructions](../cpp/README.md)
to build these compilers using the Ice for C++ sources.

Open `ice.xcproject` with Xcode and build the `Ice macOS` or `Ice iOS` target
to build Ice for Swift macOS framework or Ice for Swift iOS framework respectively.

The test programs for macOS and iOS can be built using `TestDriver macOS` and
`TestDriver iOS` respectively

## Running the Swift Tests on

Python is required to run the test suite.

### macOS

```
python allTests.py --config Debug
```

If everything worked out, you should see lots of `ok` messages. In case of a
failure, the tests abort with `failed`.

### iOS

Start the `TestDriver iOS` app on your iOS device, from Xcode.

```
python allTests.py --config Debug --platform iphoneos
```

## Install

### Carthage

In your `Cartfile` add a reference to Ice package
```
github "zeroc-ice/ice" ~> swift
```

[1]: https://zeroc.com/distributions/ice
[2]: https://doc.zeroc.com/display/Rel/Supported+Platforms+for+Ice+3.7.2