---
title: "Greeter Example"
url: https://docs.zeroc.com/ice/3.8/greeter-example
language: swift
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# Greeter Example

Programming language: Swift. Other languages: [C++](https://docs.zeroc.com/ice/3.8/greeter-example/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/greeter-example/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/greeter-example/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/greeter-example/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/greeter-example/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/greeter-example/php.md), [Python](https://docs.zeroc.com/ice/3.8/greeter-example/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/greeter-example/ruby.md).

Writing a client-server application with Ice does not take much code. See for yourself!

In this example, we describe how to write a simple client-server application, step by step.

This application is a typical Greeter: a server hosts a Greeter object that produces custom greetings, and the client calls the server to get these greetings. Even though it’s simple, this application demonstrates best practices and provides a good foundation for starting any Ice project.

We present this example in the following sections:

1. **Using Slice** How to use the [Slice IDL](https://docs.zeroc.com/ice/3.8/slice.md) to define a contract between clients and servers.
2. **Writing a server** How to implement Ice objects and host them in a server.
3. **Writing a client** How to write a client that communicates with an Ice server.

We write the server first: a client has nothing to call until a server is running.

The complete source code for this example is on [GitHub](https://github.com/zeroc-ice/ice-demos/tree/3.8/swift/Ice/Greeter), alongside several other demo programs.
