Files
LCEssentials/README.md

86 lines
2.3 KiB
Markdown
Raw Normal View History

2025-03-23 00:27:49 -03:00
![](loverde_company_logo_full.png)
Loverde Co. Essentials Swift Scripts
----
This is a repository of essential scripts written in Swift for Loverde Co. used to save time on re-writing and keeping it on all other projects. So this Cocoapods will evolve with Swift and will improve with every release!
## Requirements
- iOS 15.* or newer, Swift 5.* or newer.
## Features
- [x] Many usefull scripts extensions
- [x] `API` — typed async networking + multipart uploads. See **[Documentation/API.md](Documentation/API.md)**
2025-03-23 00:27:49 -03:00
Installation
----
#### Swift Package Manager (SPM)
``` swift
dependencies: [
2025-09-02 17:28:28 -03:00
.package(url: "https://git.loverde.com.br/Loverde-Company-LTDA/LCEssentials", .upToNextMajor(from: "1.0.0"))
2025-03-23 00:27:49 -03:00
]
```
You can also add it via XCode SPM editor with URL:
``` swift
2025-09-02 17:28:28 -03:00
https://git.loverde.com.br/Loverde-Company-LTDA/LCEssentials
2025-03-23 00:27:49 -03:00
```
## Usage example
* Background Trhead
```swift
LCEssentials.backgroundThread(delay: 0.6, background: {
//Do something im background
}) {
//When finish, update UI
}
```
* NavigationController with Completion Handler
```swift
self.navigationController?.popViewControllerWithHandler(completion: {
//Do some stuff after pop
})
//or more simple
self.navigationController?.popViewControllerWithHandler {
//Do some stuff after pop
}
```
* Networking with `API`
```swift
struct User: Decodable, Sendable { let id: Int; let name: String }
let user: User = try await API.shared.request(
url: "https://api.example.com/users/{id}",
method: .get,
pathParams: ["id": "42"]
)
```
Full guide — requests, uploads, client certificates, error handling, and why it
beats a hand-rolled `URLSession`: **[Documentation/API.md](Documentation/API.md)**
2025-03-23 00:27:49 -03:00
## Another components
> LCESnackBarView - **great way to send feedback to user**
And then import `LCEssentials ` wherever you import UIKit or SwiftUI
``` swift
import LCEssentials
```
Any question or doubts, please send thru email
Daniel Arantes Loverde - <daniel@loverde.com.br>
[![Alt text](https://loverde.com.br/_signature/loverde_github_mail.gif "My Resume")](https://github.com/loverde-co/resume/)
[![Alt text](https://loverde.com.br/_signature/loverde_github_mail.gif "Loverde Co. Github")](https://github.com/loverde-co)
2026-05-24 10:26:25 -03:00
Autor: Daniel Arantes Loverde