An open API service indexing awesome lists of open source software.

https://github.com/0xleif/morse

- --- / .- -. -.. / ..-. .-. --- -- / -- --- .-. ... . / .. -. / ... .-- .. ..-. -
https://github.com/0xleif/morse

morse swift

Last synced: 6 months ago
JSON representation

- --- / .- -. -.. / ..-. .-. --- -- / -- --- .-. ... . / .. -. / ... .-- .. ..-. -

Awesome Lists containing this project

README

          

# Morse

To and from morse in Swift.

## Example

### Hello, World!
```swift
"Hello, World!".toMorse // .... . .-.. .-.. --- --..-- / .-- --- .-. .-.. -.. -.-.--

".... . .-.. .-.. --- --..-- / .-- --- .-. .-.. -.. -.-.--".fromMorse // hello, world!
```

### Alphabet
```swift
"abcdefghijklmnopqrstuvwxyz"
.map { "\($0): \(String.morseAlphabet[$0] ?? "#")" }
.joined(separator: "\n")

/*
a: .-
b: -...
c: -.-.
d: -..
e: .
f: ..-.
g: --.
h: ....
i: ..
j: .---
k: -.-
l: .-..
m: --
n: -.
o: ---
p: .--.
q: --.-
r: .-.
s: ...
t: -
u: ..-
v: ...-
w: .--
x: -..-
y: -.--
z: --..
*/
```