2021-04-10 16:21:15 +07:00
|
|
|
# Useful Swift Things
|
2021-04-10 15:42:23 +07:00
|
|
|
|
2021-04-10 16:27:15 +07:00
|
|
|
<div align="center">
|
2021-04-13 13:32:42 +07:00
|
|
|
<img src="https://github.com/jphong1111/Useful_Swift/blob/main/Images/swift.jpeg">
|
2021-04-10 16:27:15 +07:00
|
|
|
</div>
|
2021-04-10 03:16:44 +07:00
|
|
|
|
2021-04-10 16:15:30 +07:00
|
|
|
## Content
|
2021-04-10 04:14:59 +07:00
|
|
|
- [Coding convention](#Coding-convention)
|
2021-04-10 16:05:27 +07:00
|
|
|
- [Design Pattern](#Design-Pattern)
|
2021-04-11 02:05:11 +07:00
|
|
|
- [Delegate](#Delegate)
|
|
|
|
- [Singleton](#Singleton)
|
2021-04-10 16:18:23 +07:00
|
|
|
- [Code Structuring](#Code-Structuring)
|
2021-04-10 16:20:15 +07:00
|
|
|
- [MVC](#MVC)
|
|
|
|
- [MVVM](#MVVM)
|
2021-04-10 04:19:52 +07:00
|
|
|
- [UIDesign](#UIDesign)
|
|
|
|
- [API](#API)
|
2021-04-10 15:55:09 +07:00
|
|
|
- [JSON](#JSON)
|
2021-04-10 04:30:48 +07:00
|
|
|
- [Third Party Library](#Third-Party-Library)
|
2021-04-10 03:46:16 +07:00
|
|
|
|
2021-04-10 03:16:44 +07:00
|
|
|
|
2021-04-10 03:25:46 +07:00
|
|
|
|
2021-04-10 04:13:06 +07:00
|
|
|
## Coding convention
|
2021-04-10 15:22:54 +07:00
|
|
|
set of guidelines for a specific programming language that recommend programming style
|
|
|
|
|
|
|
|
### Swift Style Guide
|
2021-04-10 04:12:26 +07:00
|
|
|
|
2021-04-10 14:51:46 +07:00
|
|
|
- [Swift Style Guide](https://github.com/linkedin/swift-style-guide)
|
2021-04-10 04:34:45 +07:00
|
|
|
|
|
|
|
### Swift Lint
|
2021-04-10 15:20:40 +07:00
|
|
|
The way of force you to adapt coding convention
|
|
|
|
>otherwise project build will **FAILED**
|
2021-04-10 15:14:13 +07:00
|
|
|
- [Swift Lint](https://github.com/realm/SwiftLint) apply for all project:+1:
|
2021-04-10 15:18:55 +07:00
|
|
|
|
2021-04-10 04:34:45 +07:00
|
|
|
put .yml file into root folder and apply following code in Build Phases
|
2021-04-10 03:47:49 +07:00
|
|
|
|
2021-04-10 16:11:11 +07:00
|
|
|
## Design Pattern
|
|
|
|
|
|
|
|
### Delegate Pattern
|
|
|
|
|
2021-04-10 16:30:44 +07:00
|
|
|
```swift
|
2021-04-10 16:11:11 +07:00
|
|
|
weak var delegate: SomeProtocol?
|
|
|
|
```
|
|
|
|
|
|
|
|
### Singleton Pattern
|
|
|
|
|
|
|
|
|
2021-04-10 16:30:44 +07:00
|
|
|
```swift
|
2021-04-10 16:11:11 +07:00
|
|
|
class SingletonPattern {
|
|
|
|
static let manager = SingletonPattern()
|
|
|
|
|
|
|
|
private init() {}
|
2021-04-10 16:11:45 +07:00
|
|
|
}
|
2021-04-10 16:11:11 +07:00
|
|
|
```
|
2021-04-10 16:18:23 +07:00
|
|
|
## Code Structuring
|
2021-04-10 16:05:27 +07:00
|
|
|
|
2021-04-10 16:18:23 +07:00
|
|
|
### MVC
|
2021-04-10 16:05:27 +07:00
|
|
|
|
2021-04-10 16:20:15 +07:00
|
|
|
### MVVM
|
|
|
|
|
2021-04-10 04:13:06 +07:00
|
|
|
## UIDesign
|
2021-04-10 03:58:50 +07:00
|
|
|
|
2021-04-10 04:16:24 +07:00
|
|
|
### HIG(Human Interface Guidelines)
|
2021-04-10 14:51:46 +07:00
|
|
|
- [Apple UI Kit](https://developer.apple.com/documentation/uikit)
|
2021-04-10 04:16:24 +07:00
|
|
|
|
2021-04-10 04:13:06 +07:00
|
|
|
### iOS icon
|
2021-04-10 04:12:26 +07:00
|
|
|
|
2021-04-10 15:45:26 +07:00
|
|
|
- [icon8](https://icons8.com/) you can download icons for your **APP**
|
2021-04-10 03:58:50 +07:00
|
|
|
|
2021-04-10 04:13:06 +07:00
|
|
|
### UIdesign inspiration
|
2021-04-10 03:58:50 +07:00
|
|
|
|
2021-04-10 04:33:17 +07:00
|
|
|
- [dribble](https://dribbble.com/)
|
|
|
|
- [pinterest](https://pinterest.com/)
|
|
|
|
- [behance](https://www.behance.net/)
|
|
|
|
- [pttrns](https://pttrns.com/)
|
|
|
|
- [awwwards](https://www.awwwards.com/)
|
|
|
|
- [flickr](http://www.flickr.com/)
|
|
|
|
- [mobbin](https://mobbin.design/)
|
|
|
|
|
|
|
|
|
2021-04-10 03:58:50 +07:00
|
|
|
|
2021-04-10 04:13:06 +07:00
|
|
|
## API
|
2021-04-10 04:12:26 +07:00
|
|
|
|
2021-04-10 04:30:48 +07:00
|
|
|
### Various API Site
|
2021-04-13 12:18:32 +07:00
|
|
|
- [rapidAPI](https://www.rapidapi.com)
|
2021-04-10 04:30:48 +07:00
|
|
|
|
2021-04-10 15:55:09 +07:00
|
|
|
## JSON
|
2021-04-10 15:58:08 +07:00
|
|
|
JSON is a language-independent data format
|
2021-04-10 16:01:31 +07:00
|
|
|
> Which is relative with **KEY - VALUE** pair
|
2021-04-10 16:30:44 +07:00
|
|
|
```json
|
2021-04-10 15:58:08 +07:00
|
|
|
{
|
2021-04-10 16:00:40 +07:00
|
|
|
"main": [
|
2021-04-10 15:58:08 +07:00
|
|
|
{
|
2021-04-10 16:00:40 +07:00
|
|
|
"title": "example1",
|
2021-04-10 16:31:31 +07:00
|
|
|
"body": "body1"
|
2021-04-10 15:58:08 +07:00
|
|
|
},
|
|
|
|
{
|
2021-04-10 16:00:40 +07:00
|
|
|
"title": "example2",
|
2021-04-10 16:31:31 +07:00
|
|
|
"body: "body2"
|
2021-04-10 15:58:08 +07:00
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|
2021-04-10 16:00:40 +07:00
|
|
|
```
|
2021-04-10 15:55:09 +07:00
|
|
|
### JSON parser extension for Chrome
|
2021-04-10 16:05:27 +07:00
|
|
|
This extension makes JSON more structable
|
2021-04-10 15:55:09 +07:00
|
|
|
[JSON parser pro](https://chrome.google.com/webstore/detail/json-viewer-pro/eifflpmocdbdmepbjaopkkhbfmdgijcc) **FREE** :+1:
|
|
|
|
|
2021-04-10 16:15:30 +07:00
|
|
|
### JSON Decoding
|
|
|
|
|
|
|
|
### JSONSerialization
|
|
|
|
|
|
|
|
|
2021-04-10 04:30:48 +07:00
|
|
|
## Third Party Library
|
2021-04-10 15:33:33 +07:00
|
|
|
[This github](https://github.com/vsouza/awesome-ios) contains all the popular libraries in Swift:+1:
|