exercism / exercism/swift

[v3] Implement new Concept Exercise: protocols

Open
#411 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
122
Forks
165
PR merge metrics
No merged PRs in 30d

Description

This issue describes how to implement the protocols concept exercise for the Swift track.

## Getting started

**Please please please read the docs before starting.** Posting PRs without reading these docs will be a lot more frustrating for you during the review cycle, and exhaust Exercism's maintainers' time. So, before diving into the implementation, please read the following documents:

- [The features of v3][docs-features-of-v3].
- [Rationale for v3][docs-rationale-for-v3].
- [What are concept exercises and how are they structured?][docs-concept-exercises]

Please also watch the following video:

- [The Anatomy of a Concept Exercise][anatomy-of-a-concept-exercise].

## Goal

This concept exercise should convey a basic understanding of how to work with protocols in Swift.

## Things to teach

- What protocols are
- Protocol syntax
- Protocol conformance
- Property requirements
- Method requirements
- init requirements
- Protocols as types
- Conformance and adoption via extensions

## Things not to teach

- Protocol extensions
- Delegation
- Protocol inheritance
- Protocol composition
- Protocols with associated types
- Class only protocols
- Conformance checking with `as`
- Optional requirements

## Concepts

- `protocols`

## Prerequisites

- `structs-and-classes`
- `enumerations`
- `properties`
- `methods`
- `initialization`

## Resources to refer to

### Hints

- [Protocol syntax][protocol-syntax]
- [Property requirements][protocol-property-requirements]
- [Method requirements][protocol-method-requirements]
- [Initializer requirements][protocol-initializer-requirements]
- [Protocols as types][protocol-as-type]
- [Protocols via extension][protocol-via-extension]

### After

- [Protocol syntax][protocol-syntax]
- [Property requirements][protocol-property-requirements]
- [Method requirements][protocol-method-requirements]
- [Initializer requirements][protocol-initializer-requirements]
- [Protocols as types][protocol-as-type]
- [Protocols via extension][protocol-via-extension]

## Representer

TBD

## Analyzer

TBD

## Implementing

See [the Swift track implementation guide][swift-implementing-concept-exercises] for guidance.

## Help

If you have any questions while implementing the exercise, please post the questions as comments in this issue.

[swift-implementing-concept-exercises]: https://github.com/wneumann/v3/blob/master/languages/swift/reference/implementing-a-concept-exercise.md
[protocol-syntax]: https://docs.swift.org/swift-book/LanguageGuide/Protocols.html#ID268
[protocol-property-requirements]: https://docs.swift.org/swift-book/LanguageGuide/Protocols.html#ID269
[protocol-method-requirements]: https://docs.swift.org/swift-book/LanguageGuide/Protocols.html#ID270
[protocol-initializer-requirements]: https://docs.swift.org/swift-book/LanguageGuide/Protocols.html#ID272
[protocol-as-type]: https://docs.swift.org/swift-book/LanguageGuide/Protocols.html#ID275
[protocol-via-extension]: https://docs.swift.org/swift-book/LanguageGuide/Protocols.html#ID277
[docs-concept-exercises]: ../../../docs/concept-exercises.md
[docs-rationale-for-v3]: ../../../docs/rationale-for-v3.md
[docs-features-of-v3]: ../../../docs/features-of-v3.md
[anatomy-of-a-concept-exercise]: https://www.youtube.com/watch?v=gkbBqd7hPrA

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.