Skip to content

Commit

Permalink
Improve documentation, update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobSyndeo committed Feb 7, 2024
1 parent 73ee20b commit d05c703
Show file tree
Hide file tree
Showing 42 changed files with 62 additions and 59 deletions.
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ A really useful way to use `UIAlertController`, using extensions.
Let's say you want to show a basic alert.

Rather than writing this:
```Swift
```swift
let alertController = UIAlertController(title: "Title", message: "Message")

let okAction = UIAlertAction(title: "OK", style: .default) { _ in
Expand All @@ -18,14 +18,14 @@ present(alertController, animated: true, completion: nil)
```

You can write this:
```Swift
```swift
UIAlertController.showBasicAlert("Title", message: "Message")
```

Not a big enough difference for you? Okay, let's suppose you've got a more complicated one.

Instead of THIS:
```Swift
```swift
let alertController = UIAlertController(title: "Title", message: "Message")

let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { _ in
Expand All @@ -43,14 +43,14 @@ present(alertController, animated: true, completion: nil)
```

Why not have this:
```Swift
```swift
UIAlertController.showOKCancelAlert("Title", message: "Message") { confirmed in
// Handle OK or Cancel based on `confirmed` being true or false
}
```

Or, if you're using Swift Concurrency:
```Swift
```swift
if await UIAlertController.showOKCancelAlert("Title", message: "Message") {
// User tapped OK!
}
Expand All @@ -76,7 +76,15 @@ With GreenAlert, you're granted all sorts of `UIAlertController` superpowers, in

So give it a shot! 😁

## Documentation

For more information, check out the [documentation](https://ether.jacobpritchett.app/documentation/ether)!

## Support

If you're anything less than delighted, or have any ideas on how to improve GreenAlert, be sure to [open an issue](https://github.com/JacobSyndeo/GreenAlert/issues), and I'll be sure to address it!

## More

If you like GreenAlert, be sure to check out my other projects:
- 🎆 [Ether](https://github.com/JacobSyndeo/Ether), a _delightful_ networking library for Swift
- 🎆 [Ether](https://github.com/JacobSyndeo/Ether), a delightful and easy to understand networking library for Swift
14 changes: 9 additions & 5 deletions Sources/GreenAlert/Documentation.docc/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GreenAlert is a really useful way to use `UIAlertController`, using extensions.
Let's say you want to show a basic alert.

Rather than writing this:
```Swift
```swift
let alertController = UIAlertController(title: "Title", message: "Message")

let okAction = UIAlertAction(title: "OK", style: .default) { _ in
Expand All @@ -22,14 +22,14 @@ present(alertController, animated: true, completion: nil)
```

You can write this:
```Swift
```swift
UIAlertController.showBasicAlert("Title", message: "Message")
```

Not a big enough difference for you? Okay, let's suppose you've got a more complicated one.

Instead of THIS:
```Swift
```swift
let alertController = UIAlertController(title: "Title", message: "Message")

let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { _ in
Expand All @@ -47,14 +47,14 @@ present(alertController, animated: true, completion: nil)
```

Why not have this:
```Swift
```swift
UIAlertController.showOKCancelAlert("Title", message: "Message") { confirmed in
// Handle OK or Cancel based on `confirmed` being true or false
}
```

Or, if you're using Swift Concurrency:
```Swift
```swift
if await UIAlertController.showOKCancelAlert("Title", message: "Message") {
// User tapped OK!
}
Expand All @@ -80,7 +80,11 @@ With GreenAlert, you're granted all sorts of `UIAlertController` superpowers, in

So give it a shot! 😁

## Support

If you're anything less than delighted, or have any ideas on how to improve GreenAlert, be sure to [open an issue](https://github.com/JacobSyndeo/GreenAlert/issues), and I'll be sure to address it!

## More

If you like GreenAlert, be sure to check out my other projects:
- 🎆 [Ether](https://github.com/JacobSyndeo/Ether), a delightful and easy to understand networking library for Swift
9 changes: 0 additions & 9 deletions buildDocs.sh

This file was deleted.

2 changes: 1 addition & 1 deletion docs/data/documentation/greenalert.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/data/documentation/greenalert/introduction.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"kind":"article","metadata":{"roleHeading":"Article","modules":[{"name":"GreenAlert"}],"role":"article","title":"Introduction"},"abstract":[{"text":"What is GreenAlert, and why should you use it?","type":"text"}],"sections":[],"hierarchy":{"paths":[["doc:\/\/GreenAlert\/documentation\/GreenAlert"]]},"schemaVersion":{"minor":3,"patch":0,"major":0},"primaryContentSections":[{"kind":"content","content":[{"type":"heading","text":"What is GreenAlert?","anchor":"What-is-GreenAlert","level":2},{"inlineContent":[{"text":"GreenAlert is a really useful way to use ","type":"text"},{"type":"codeVoice","code":"UIAlertController"},{"text":", using extensions.","type":"text"}],"type":"paragraph"},{"inlineContent":[{"text":"Let’s say you want to show a basic alert.","type":"text"}],"type":"paragraph"},{"inlineContent":[{"text":"Rather than writing this:","type":"text"}],"type":"paragraph"},{"code":["let alertController = UIAlertController(title: \"Title\", message: \"Message\")","","let okAction = UIAlertAction(title: \"OK\", style: .default) { _ in"," ()","}","","alertController.addAction(okAction)","","present(alertController, animated: true, completion: nil)"],"type":"codeListing","syntax":"Swift"},{"inlineContent":[{"type":"text","text":"You can write this:"}],"type":"paragraph"},{"syntax":"Swift","type":"codeListing","code":["UIAlertController.showBasicAlert(\"Title\", message: \"Message\")"]},{"type":"paragraph","inlineContent":[{"text":"Not a big enough difference for you? Okay, let’s suppose you’ve got a more complicated one.","type":"text"}]},{"inlineContent":[{"type":"text","text":"Instead of THIS:"}],"type":"paragraph"},{"code":["let alertController = UIAlertController(title: \"Title\", message: \"Message\")","","let cancelAction = UIAlertAction(title: \"Cancel\", style: .cancel) { _ in"," \/\/ handle Cancel","}","","let okAction = UIAlertAction(title: \"OK\", style: .default) { _ in"," \/\/ handle OK","}","","alertController.addAction(cancelAction)","alertController.addAction(okAction)","","present(alertController, animated: true, completion: nil)"],"type":"codeListing","syntax":"Swift"},{"inlineContent":[{"text":"Why not have this:","type":"text"}],"type":"paragraph"},{"code":["UIAlertController.showOKCancelAlert(\"Title\", message: \"Message\") { confirmed in"," \/\/ Handle OK or Cancel based on `confirmed` being true or false","}"],"syntax":"Swift","type":"codeListing"},{"type":"paragraph","inlineContent":[{"type":"text","text":"Or, if you’re using Swift Concurrency:"}]},{"type":"codeListing","code":["if await UIAlertController.showOKCancelAlert(\"Title\", message: \"Message\") {"," \/\/ User tapped OK!","}"],"syntax":"Swift"},{"inlineContent":[{"type":"text","text":"Now, isn’t that nicer?"}],"type":"paragraph"},{"inlineContent":[{"inlineContent":[{"type":"text","text":"But wait, there’s more."}],"type":"emphasis"}],"type":"paragraph"},{"inlineContent":[{"text":"With GreenAlert, you’re granted all sorts of ","type":"text"},{"type":"codeVoice","code":"UIAlertController"},{"text":" superpowers, including the following:","type":"text"}],"type":"paragraph"},{"items":[{"content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"Customizations galore"}]},{"items":[{"content":[{"inlineContent":[{"type":"text","text":"SAFELY set alert style to action sheet, using enums to enforce the presence of source information."}],"type":"paragraph"},{"items":[{"content":[{"inlineContent":[{"type":"text","text":"I say “safely” here because you can easily crash an iPadOS app by creating an "},{"type":"codeVoice","code":".actionSheet"},{"type":"text","text":" and forgetting to set the "},{"type":"codeVoice","code":"popoverPresentationController"},{"type":"text","text":"‘s "},{"type":"codeVoice","code":"sourceView"},{"text":", ","type":"text"},{"code":"sourceRect","type":"codeVoice"},{"text":", or ","type":"text"},{"type":"codeVoice","code":"barButtonItem"},{"type":"text","text":". These crashes don’t occur on iPhones, and are therefore easy to miss if you don’t test throughly. Using GreenAlert eliminates these crashes."}],"type":"paragraph"}]}],"type":"unorderedList"}]},{"content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"Custom button action icons, via SF Symbols (preferred) or a "},{"code":"UIImage","type":"codeVoice"}]}]}],"type":"unorderedList"}]},{"content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"Show prompts for values"}]},{"type":"unorderedList","items":[{"content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"With all the customizations listed above, but also including customizable:"}]},{"items":[{"content":[{"inlineContent":[{"text":"preset text","type":"text"}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"placeholder"}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"text":"keyboard type","type":"text"}],"type":"paragraph"}]}],"type":"unorderedList"}]}]}]},{"content":[{"inlineContent":[{"type":"text","text":"Add progress bars to alert controllers"}],"type":"paragraph"}]}],"type":"unorderedList"},{"type":"paragraph","inlineContent":[{"text":"…And even more!","type":"text"}]},{"inlineContent":[{"text":"So give it a shot! 😁","type":"text"}],"type":"paragraph"},{"inlineContent":[{"type":"text","text":"If you’re anything less than delighted, or have any ideas on how to improve GreenAlert, be sure to "},{"isActive":true,"identifier":"https:\/\/github.com\/JacobSyndeo\/GreenAlert\/issues","type":"reference"},{"type":"text","text":", and I’ll be sure to address it!"}],"type":"paragraph"},{"type":"paragraph","inlineContent":[{"text":"If you like GreenAlert, be sure to check out my other projects:","type":"text"}]},{"items":[{"content":[{"inlineContent":[{"type":"text","text":"🎆 "},{"isActive":true,"type":"reference","identifier":"https:\/\/github.com\/JacobSyndeo\/Ether"},{"type":"text","text":", a delightful and easy to understand networking library for Swift"}],"type":"paragraph"}]}],"type":"unorderedList"}]}],"variants":[{"paths":["\/documentation\/greenalert\/introduction"],"traits":[{"interfaceLanguage":"swift"}]}],"identifier":{"url":"doc:\/\/GreenAlert\/documentation\/GreenAlert\/Introduction","interfaceLanguage":"swift"},"references":{"doc://GreenAlert/documentation/GreenAlert":{"title":"GreenAlert","url":"\/documentation\/greenalert","type":"topic","role":"collection","kind":"symbol","identifier":"doc:\/\/GreenAlert\/documentation\/GreenAlert","abstract":[]},"https://github.com/JacobSyndeo/Ether":{"identifier":"https:\/\/github.com\/JacobSyndeo\/Ether","titleInlineContent":[{"text":"Ether","type":"text"}],"url":"https:\/\/github.com\/JacobSyndeo\/Ether","type":"link","title":"Ether"},"https://github.com/JacobSyndeo/GreenAlert/issues":{"identifier":"https:\/\/github.com\/JacobSyndeo\/GreenAlert\/issues","title":"open an issue","titleInlineContent":[{"type":"text","text":"open an issue"}],"type":"link","url":"https:\/\/github.com\/JacobSyndeo\/GreenAlert\/issues"}}}
{"schemaVersion":{"major":0,"patch":0,"minor":3},"sections":[],"metadata":{"role":"article","roleHeading":"Article","modules":[{"name":"GreenAlert"}],"title":"Introduction"},"identifier":{"url":"doc:\/\/GreenAlert\/documentation\/GreenAlert\/Introduction","interfaceLanguage":"swift"},"primaryContentSections":[{"content":[{"text":"What is GreenAlert?","level":2,"anchor":"What-is-GreenAlert","type":"heading"},{"type":"paragraph","inlineContent":[{"type":"text","text":"GreenAlert is a really useful way to use "},{"code":"UIAlertController","type":"codeVoice"},{"type":"text","text":", using extensions."}]},{"type":"paragraph","inlineContent":[{"text":"Let’s say you want to show a basic alert.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Rather than writing this:","type":"text"}]},{"type":"codeListing","code":["let alertController = UIAlertController(title: \"Title\", message: \"Message\")","","let okAction = UIAlertAction(title: \"OK\", style: .default) { _ in"," ()","}","","alertController.addAction(okAction)","","present(alertController, animated: true, completion: nil)"],"syntax":"swift"},{"type":"paragraph","inlineContent":[{"type":"text","text":"You can write this:"}]},{"code":["UIAlertController.showBasicAlert(\"Title\", message: \"Message\")"],"type":"codeListing","syntax":"swift"},{"type":"paragraph","inlineContent":[{"text":"Not a big enough difference for you? Okay, let’s suppose you’ve got a more complicated one.","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"text","text":"Instead of THIS:"}]},{"type":"codeListing","syntax":"swift","code":["let alertController = UIAlertController(title: \"Title\", message: \"Message\")","","let cancelAction = UIAlertAction(title: \"Cancel\", style: .cancel) { _ in"," \/\/ handle Cancel","}","","let okAction = UIAlertAction(title: \"OK\", style: .default) { _ in"," \/\/ handle OK","}","","alertController.addAction(cancelAction)","alertController.addAction(okAction)","","present(alertController, animated: true, completion: nil)"]},{"type":"paragraph","inlineContent":[{"text":"Why not have this:","type":"text"}]},{"syntax":"swift","code":["UIAlertController.showOKCancelAlert(\"Title\", message: \"Message\") { confirmed in"," \/\/ Handle OK or Cancel based on `confirmed` being true or false","}"],"type":"codeListing"},{"type":"paragraph","inlineContent":[{"text":"Or, if you’re using Swift Concurrency:","type":"text"}]},{"syntax":"swift","code":["if await UIAlertController.showOKCancelAlert(\"Title\", message: \"Message\") {"," \/\/ User tapped OK!","}"],"type":"codeListing"},{"type":"paragraph","inlineContent":[{"type":"text","text":"Now, isn’t that nicer?"}]},{"inlineContent":[{"type":"emphasis","inlineContent":[{"type":"text","text":"But wait, there’s more."}]}],"type":"paragraph"},{"type":"paragraph","inlineContent":[{"text":"With GreenAlert, you’re granted all sorts of ","type":"text"},{"type":"codeVoice","code":"UIAlertController"},{"type":"text","text":" superpowers, including the following:"}]},{"items":[{"content":[{"inlineContent":[{"type":"text","text":"Customizations galore"}],"type":"paragraph"},{"type":"unorderedList","items":[{"content":[{"inlineContent":[{"type":"text","text":"SAFELY set alert style to action sheet, using enums to enforce the presence of source information."}],"type":"paragraph"},{"items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"I say “safely” here because you can easily crash an iPadOS app by creating an ","type":"text"},{"type":"codeVoice","code":".actionSheet"},{"text":" and forgetting to set the ","type":"text"},{"code":"popoverPresentationController","type":"codeVoice"},{"type":"text","text":"‘s "},{"code":"sourceView","type":"codeVoice"},{"type":"text","text":", "},{"code":"sourceRect","type":"codeVoice"},{"type":"text","text":", or "},{"code":"barButtonItem","type":"codeVoice"},{"type":"text","text":". These crashes don’t occur on iPhones, and are therefore easy to miss if you don’t test throughly. Using GreenAlert eliminates these crashes."}]}]}],"type":"unorderedList"}]},{"content":[{"inlineContent":[{"type":"text","text":"Custom button action icons, via SF Symbols (preferred) or a "},{"type":"codeVoice","code":"UIImage"}],"type":"paragraph"}]}]}]},{"content":[{"inlineContent":[{"type":"text","text":"Show prompts for values"}],"type":"paragraph"},{"type":"unorderedList","items":[{"content":[{"inlineContent":[{"type":"text","text":"With all the customizations listed above, but also including customizable:"}],"type":"paragraph"},{"type":"unorderedList","items":[{"content":[{"inlineContent":[{"type":"text","text":"preset text"}],"type":"paragraph"}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"placeholder","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"keyboard type"}]}]}]}]}]}]},{"content":[{"inlineContent":[{"type":"text","text":"Add progress bars to alert controllers"}],"type":"paragraph"}]}],"type":"unorderedList"},{"inlineContent":[{"text":"…And even more!","type":"text"}],"type":"paragraph"},{"inlineContent":[{"type":"text","text":"So give it a shot! 😁"}],"type":"paragraph"},{"level":2,"type":"heading","text":"Support","anchor":"Support"},{"type":"paragraph","inlineContent":[{"text":"If you’re anything less than delighted, or have any ideas on how to improve GreenAlert, be sure to ","type":"text"},{"isActive":true,"type":"reference","identifier":"https:\/\/github.com\/JacobSyndeo\/GreenAlert\/issues"},{"text":", and I’ll be sure to address it!","type":"text"}]},{"anchor":"More","type":"heading","level":2,"text":"More"},{"inlineContent":[{"type":"text","text":"If you like GreenAlert, be sure to check out my other projects:"}],"type":"paragraph"},{"items":[{"content":[{"inlineContent":[{"type":"text","text":"🎆 "},{"isActive":true,"type":"reference","identifier":"https:\/\/github.com\/JacobSyndeo\/Ether"},{"type":"text","text":", a delightful and easy to understand networking library for Swift"}],"type":"paragraph"}]}],"type":"unorderedList"}],"kind":"content"}],"kind":"article","hierarchy":{"paths":[["doc:\/\/GreenAlert\/documentation\/GreenAlert"]]},"abstract":[{"type":"text","text":"What is GreenAlert, and why should you use it?"}],"variants":[{"paths":["\/documentation\/greenalert\/introduction"],"traits":[{"interfaceLanguage":"swift"}]}],"references":{"doc://GreenAlert/documentation/GreenAlert":{"role":"collection","url":"\/documentation\/greenalert","title":"GreenAlert","abstract":[],"type":"topic","kind":"symbol","identifier":"doc:\/\/GreenAlert\/documentation\/GreenAlert"},"https://github.com/JacobSyndeo/Ether":{"titleInlineContent":[{"type":"text","text":"Ether"}],"identifier":"https:\/\/github.com\/JacobSyndeo\/Ether","url":"https:\/\/github.com\/JacobSyndeo\/Ether","type":"link","title":"Ether"},"https://github.com/JacobSyndeo/GreenAlert/issues":{"identifier":"https:\/\/github.com\/JacobSyndeo\/GreenAlert\/issues","titleInlineContent":[{"type":"text","text":"open an issue"}],"type":"link","url":"https:\/\/github.com\/JacobSyndeo\/GreenAlert\/issues","title":"open an issue"}}}
Loading

0 comments on commit d05c703

Please sign in to comment.