ObserveSingleEventOfType(ChildAdded) only return one snapshot Firebase [closed] - swift

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I have 3 FirDataSnapshot. When I am using observeEventType(.ChildAdded,..), it returns 3 item. When I use observeSingeEventTypeOf, it returns only 1 snapshot. I don't know why.

observeSingleEventType returns single value means it observe .childAdded only once ... the block is immediately canceled after the initial data is returned.
If you are using observeEventType than it gets all values from database ..

Related

Is Swift string count included in string storage? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
This post was edited and submitted for review 1 year ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
My app involves repeated equality comparisons of many megabytes of an array of strings. I was (naively?) surprised that such comparisons became immensely faster when I added a shadow array of the count of each string; if the counts are not equal, the strings cannot be equal.
I would have thought that the Swift compiler could easily and efficiently maintain a string's count in the internal representation, and short-circuit string equality comparisons if the counts differ. The initial creation of each string would provide the opportunity to initialize the count, and each manipulation would then know the count of each participant. But it seems not so. If only some applications would benefit from a stored count, a compiler switch to turn it on could help them.
Would this be a reasonable standard library refinement?
The problem with String is that it is not stored always in the same way. There are different types of storage and for them to be properly compared, they have to be converted to the same representation first.
Looking into the source code here: StringComparison.swift, I think you are right and count should be compared first when checking equality.
I recommend filing a bug.

Firestore write data missing [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I have this code, and it is supposed to write to Firestore. However, when it does the function, in the back end, it shows highlighted as red and then disappears.
db.collection("jokes").document("Dad Jokes").setData(["\(dadJokeNum + 1)": Joke.text!])
Please help.
Using SetData without Merge will delete existing values - it is suggested that if the document exists prior, you should always be using merge: true. Firestore also has a limited 1 write per second each, you should be managing writes together as it is most likely similar writes will conflict and potentially resolve out of order.

Why dosen't timeIntervalSince1970 show up in Xcode? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I want to convert the timestamp I have saved to Firebase to real time time. I have seen some codes here, and watched some youtube videos, but for some odd reason I can't get the timeIntervalSince1970 function up?
The only available function I can call is NSTimeIntervalSince1970. Why is this?
timeIntervalSince1970 is a property of Date. A Firestore Timestamp object is not a Date - it is its own type. If you want to convert it to a Date, you can call its dateValue() method. This will give you a Date, and you can use timeIntervalSince1970 on that.
Or, even better, you can use the seconds property on the Timestamp directly and skip Date altogether.
You should just be able to use Date().timeIntervalSince1970

JCL/REXX - Members in a PDS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
How can I create a member in a PDS using either JCL or REXX? The member's name must contain the actual date. Is that possible?
It can be done in JCL and by Rexx. You need to remember that member names are a maximum of 8 bytes and cannot start with a numeric so you would need to use something like the 'Julian' date e.g. 2017365. You may have system variables available to populate your JCL - check the JCL manual and level of Z/os that you are using.

observing two children from a database in swift from firebase [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Is there an effective way to observe two nodes at once from firebase? Could you write sample code for it if possible?
Put call for the second node in the completionBlock of the first one:
For example i have my user's location coordinates(lat and lng) stored in two node's stored under my UserId:-
ref.child(FIRAuth.auth()!.currentUser!.uid).child("latitude").observeEventType(.Value, withBlock: {(SnapshotLAT) in
ref.child(FIRAuth.auth()!.currentUser!.uid).child("longitude").observeEventType(.Value, withBlock: {(SnapshotLNG) in
.....
.....
})
})
Maybe i could help you more if you posted your JSON structure here....