Comments (16)
@SebastianBO You need to explain the detailed situation.
from ballcap-ios.
Sorry,
Latest Xcode/Pring version.
The model is "Modelable" and yet I get the error, Object' does not conform to protocol 'Modelable'.
Tried a lot of various solutions, what am I missing?
Thanks for the great work.
- Get documents
let document: Document<Model> = Document("DOCUMENT_ID")
document.get { (document, error) in
print(document.data)
}
- Collection Reference
let query: DataSource<Document<Item>>.Query = DataSource.Query(Firestore.firestore().collectionGroup("items")) let dataSource = DataSource(reference: query)
from ballcap-ios.
Thank you for using Pring.
In this library, Document and Model are separated.
Modelable
is a Protocol for defining a Model.
Object
has Model as a property.
https://github.com/1amageek/Ballcap-iOS#scheme
Any struct that conforms to Modelable & Codable
can be handled byDocument <Model>
.
Document
is a class created by inheriting Object
.
from ballcap-ios.
Been trying to solve this over the weekend, with your updated scheme and instructions. It would be nice with a working example of subcollections and retrieve a specific document
from ballcap-ios.
let documentReference: DocumentReference = firestore.document("YOUR_PATH")
let doc: Document<Model> = Document(documentReference)
Document<Model>.get(documentReference: documentReference) { document, error
}
from ballcap-ios.
Even more confusing
from ballcap-ios.
@SebastianBO
I don't know what you want to understand.
You need to prepare sample code and a reproducible environment.
Use Document
let documentReference: DocumentReference = firestore.document("YOUR_PATH")
let doc: Document<Model> = Document(documentReference)
Document<Model>.get(documentReference: documentReference) { document, error
}
Use Class that inherits Object
let documentReference: DocumentReference = firestore.document("YOUR_PATH")
let user: User = User(documentReference)
// get from document ref
User.get(documentReference: documentReference) { user, error
}
// get from document id
User.get(id: "USER_ID") { user, error
}
from ballcap-ios.
Agree, sorry.
- Sub Collection as DataSource - not getting it to work in SwiftUI
- Retrieve specific document from DB (User) guess it's answered above
- Create/Save a document with a specific ID.
Where can I donate to this project?
from ballcap-ios.
@SebastianBO
Can you publish part of your code with gist? It would be better for me to see it.
from ballcap-ios.
Sub Collection as DataSource - not getting it to work in SwiftUI
https://github.com/1amageek/Ballcap-iOS/blob/master/README.md#your-custom-object
Create/Save a document with a specific ID.
https://github.com/1amageek/Ballcap-iOS/blob/master/README.md#initialization
from ballcap-ios.
Thank you a lot, very appreciated! I'll come back with results if interested
from ballcap-ios.
let uid = Auth.auth().currentUser!.uid let document: Document<User.Model> = Document(id: uid) document.save()
This saves it to "document collection"
and not override class var name: String { "users" } collection
from ballcap-ios.
from ballcap-ios.
@SebastianBO What version are you using?
If it's happening in the latest version, it's a bug, so please describe the code that can be reproduced with a new issue.
I need to fix it.
from ballcap-ios.
It's the latest version.
Just create a document with a specific ID gives this results.
from ballcap-ios.
Thank you.
I'm testing, but that doesn't happen.
Publish a repository that can be reproduced.
https://github.com/1amageek/Ballcap-iOS/blob/master/BallcapTests/DocumentTests.swift#L61
https://github.com/1amageek/Ballcap-iOS/blob/master/BallcapTests/DocumentTests.swift#L201
from ballcap-ios.
Related Issues (19)
- Support Jazzy
- How to remove document<> HOT 7
- FR: DataSource support BindableObject HOT 2
- [Not issue]
- configure is inaccessible HOT 1
- DataSource updates not working for last deleted document in collection HOT 2
- Support SwiftLint
- A way to avoid Firestore crash
- WithSwiftUI Sample Crash
- Support for Swift Package Manager
- Allow initialization of Object subclasses with models
- Consider adding to firebaseopensource.com HOT 1
- Support Cocoapods
- Is it possible to remove a field from a document
- FIRQuerySnapshotBlock is unavailable in Swift HOT 1
- firebase SDKのバージョンアップ
- documentReference issue HOT 1
- data optional HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ballcap-ios.