Skip to content

Commit a4811f4

Browse files
committed
Publish v0.7.5
1 parent 594e7e4 commit a4811f4

2 files changed

Lines changed: 27 additions & 18 deletions

File tree

README.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SQLiteAdapter
22

33
[![Swift](https://img.shields.io/badge/Swift-5-orange.svg?style=flat)](https://swift.org)
4-
[![Platform](https://img.shields.io/badge/platform-iOS%20%7C%20macOS%20%7C%20watchOS%20%7C%20tvOS-lightgrey.svg)](https://developer.apple.com/swift/)
4+
[![Platform](https://img.shields.io/badge/platform-iOS%20%7C%20macOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20Linux-lightgrey.svg)](https://developer.apple.com/swift/)
55

66
A simple wrapper around SQLite3.
77

@@ -10,10 +10,18 @@ Installation
1010

1111
#### Swift Package Manager
1212

13-
To install SQLiteAdapter using [Swift Package Manager](https://swift.org/package-manager):
13+
To install SQLiteAdapter using [Swift Package Manager](https://swift.org/package-manager), add the following in your `Package.swift`:
14+
15+
```swift
16+
dependencies: [
17+
.package(url: "https://github.com/denissimon/SQLiteAdapter.git", from: "0.7.5")
18+
]
19+
```
20+
21+
Or through Xcode:
1422

1523
```txt
16-
Xcode: File -> Add Packages
24+
File -> Add Packages
1725
Enter Package URL: https://github.com/denissimon/SQLiteAdapter
1826
```
1927

@@ -40,7 +48,7 @@ Copy folder `SQLiteAdapter` into your project.
4048
Usage
4149
-----
4250

43-
**Opening the database**
51+
### Open the database
4452

4553
```swift
4654
import SQLiteAdapter
@@ -52,7 +60,7 @@ let sqlite = try? SQLite(path: dbPath) // with 'recreate: true', the sqlite file
5260
print(sqlite.dbPath) // -> path of the sqlite file
5361
```
5462

55-
**Modeling and creating a table**
63+
### Model and create a table
5664

5765
```swift
5866
let sqlTable = SQLTable(
@@ -79,7 +87,7 @@ let statementCreateTable = """
7987
try? sqlite?.createTable(sql: statementCreateTable)
8088
```
8189

82-
**SQL operations**
90+
### SQL operations
8391

8492
```swift
8593
do {
@@ -116,25 +124,30 @@ do {
116124
}
117125
```
118126

127+
Read methods return `nil` if no rows have been read:
128+
119129
```swift
120-
// Read methods return nil if no rows have been read
121130
let row = try sqlite.getByID(from: sqlTable, id: 10) // -> nil
131+
```
122132

123-
// Insert, update, and delete methods return the number of changes made
133+
Insert, update, and delete methods return the number of changes made:
134+
135+
```swift
124136
let changes = try sqlite.deleteAllRows(in: sqlTable) // -> 1
125137
```
126138

127-
**Optional settings**
139+
### Optional settings
128140

129141
```swift
130142
sqlite.dateFormatter.locale = Locale(identifier: "en_US_POSIX")
131143
sqlite.dateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
132144
sqlite.dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
133145
```
134-
146+
135147
More usage examples can be found in [tests](https://github.com/denissimon/SQLiteAdapter/blob/main/Tests/SQLiteAdapterTests/SQLiteAdapterTests.swift) and [iOS-MVVM-Clean-Architecture](https://github.com/denissimon/iOS-MVVM-Clean-Architecture) where this adapter was used.
136148

137-
### Supported SQLite types
149+
Supported SQLite types
150+
----------------------
138151

139152
```swift
140153
case INT // Includes INT, INTEGER, INT2, INT8, BIGINT, MEDIUMINT, SMALLINT, TINYINT
@@ -145,7 +158,8 @@ case BLOB // Includes BLOB, BINARY, VARBINARY
145158
case DATE // Includes DATE, DATETIME, TIME, TIMESTAMP
146159
```
147160

148-
### Public methods
161+
Public methods
162+
--------------
149163

150164
Can be extended and customized by inheriting the [SQLite](https://github.com/denissimon/SQLiteAdapter/blob/main/Sources/SQLiteAdapter/SQLiteAdapter.swift) class.
151165

@@ -174,11 +188,6 @@ func vacuum() throws
174188
func query(sql: String, params: [Any]?) throws -> Int
175189
```
176190

177-
Requirements
178-
------------
179-
180-
iOS 12.0+, macOS 10.13.0+, tvOS 12.0+, watchOS 4.0+
181-
182191
License
183192
-------
184193

SQLiteAdapter.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'SQLiteAdapter'
3-
s.version = '0.7.4'
3+
s.version = '0.7.5'
44
s.homepage = 'https://github.com/denissimon/SQLiteAdapter'
55
s.authors = { 'Denis Simon' => 'denis.v.simon@gmail.com' }
66
s.summary = 'A simple wrapper around SQLite3'

0 commit comments

Comments
 (0)