Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lourenco-marinho/Lens
Lens is a very simple yet elegant query builder made in Swift to work with CoreData.
https://github.com/lourenco-marinho/Lens
Last synced: 3 months ago
JSON representation
Lens is a very simple yet elegant query builder made in Swift to work with CoreData.
- Host: GitHub
- URL: https://github.com/lourenco-marinho/Lens
- Owner: lourenco-marinho
- License: mit
- Created: 2015-03-09T19:10:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-10-30T19:58:27.000Z (about 9 years ago)
- Last Synced: 2024-07-17T20:39:04.920Z (4 months ago)
- Language: Swift
- Size: 363 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![Lens](Lens.png)
Lens is a very simple yet elegant query builder made in Swift to work with CoreData.
Features
--
- [x] Chainable method calls
- [x] Generics SupportRequirements
--
- iOS 7.0+ / Mac OS X 10.9+
- Xcode 6.1Installation
--
You can use [CocoaPods](https://cocoapods.org/) to integrate Lens in your project.
You can install it with the following command```
$ gem install cocoapods
```Update your ```Podfile``` to use Lens
```
pod 'Lens'
```
Then, run the following command```
$ pod install
```Usage
--### Query all objects from a single entity
```swift
lens(forEntity: Person.self, managedObjectContext).look();
```### Query entities based on their properties.
```swift
lens(forEntity: Person.self, managedObjectContext).find(@"name").equals(@"John").look();
```### Compound your queries.
```swift
lens(forEntity: Person.self, managedObjectContext).find(@"name").equals(@"John").and(@"age").equals(26).look();
```### Sort your results
```swift
lens(forEntity: Person.self, inContext: managedObjectContext).sort("name", ascending: true).look();
```Who to blame
--
- [Lourenço Marinho](http://github.com/lourenco-marinho) ([@lopima](https://twitter.com/lopima))More
--
Lens is a working in progress so feel free to fork this project and improve it!License
--
Lens is released under the MIT license. See LICENSE for details.