This question already has answers here:
Choosing the right IOS XML parser [closed]
(5 answers)
Closed 9 years ago.
So I need to decide which iOS XML Parser to use for my new app. I will be downloading large documents from a website and parsing them into TableView cells as well as normal views. So it needs to be quick and easy to use.
Also, I would like the ability to parse the document, while downloading. So if I am scrolling in a tableView - I don't want to UI to lock up due to XML Parsing?
I guess I could use GDC to use overcome this?
I looked at TBXML and the libxml2 SAX XML parsers.
Any ideas?
Thanks guys.
p.S: I realise this is a duplicate question - However I wanted to see if TBXML was still used or now deprecated like the ASIHTTPRequest network API (Where AFnetworking is used now)
I would recommend to use TBXML as it takes lowest time comparatively to parse a document. To implement this surely you need multi-threading(GCD). You can implement this like lazy-loading concept, adding more rows as scroll reach to last.
Related
This question already has an answer here:
How to make offline database for my app?
(1 answer)
Closed 6 years ago.
I'm currently working on an application in Xcode 8/Swift 3 which runs through APIs. Essentially, I'm parsing information using SwiftyJSON from my MySQL database which keeps the content current and easily updated.
To keep it so the content is also available offline, I'd like to introduce a facility where the data is downloaded and stored on the phone so it is available in "offline mode".
I know it's a completely open question but can anyone point me in the correct direction of how I could make this JSON information available offline? I've tried searching the net with no success.
I know it's not Swift, but the absolute master of this has recently open sauced his master piece: Dash for iOS.
Reviewing what he's done to get rapid scrolling and searches might give some deep insight into how to best do this as done by someone with (arguably) more experience in this area than anyone other than Apple:
https://github.com/Kapeli/Dash-iOS
I will prefer here 2 option either I will go with 1.SQLite DB or 2. NSURLCache
For SQLite DB you can use FMDB wrapper-https://github.com/ccgus/fmdb
For NSURLCache check this link Best way to Cache JSON from API in SWIFT?
If you just want to save json then go with NSURLCache for offline mode.
Achieving offline for iOS is having two best paths they are CoreData and SQLITE. As per the definition of CoreData suggests it is a Model layer of the project. It comes with less efforts on developer side. Bit contrast SQLITE having the same way but little efforts on it.
In my project we are using the CoreData for offline maintenance. Really we have few concerns on the Relational data fetching, Although there is a Predicates representing CoreData for the same still it is limited to some part. These type of situations SQLITE is really a life saver. We can easily fetch the records with simple JOIN commands.
Conclusion:
If you have more complex data relations it's really better to go with the SQLITE, Apart from CoreData is best choice.
I need to present and open pdf documents in my app. I would like to avoid third part libraries, because of update reasons (and I couldn´t find anyone created in swift).
I have been looking at QLPreviewController, UIDocumentInteractionController and presenting the pdf in an UIWebView. All these alternatives works fine for just presenting the pdf but I can´t find any built in search. I want functionality like the iBooks app.
Any advice is appreciated!
You'll likely wont find any 3rd-party frameworks written in Swift yet, simply because as of Swift 2.2 it's not binary compatible yet, and any binary framework written in Swift would be very fragile to break with even a minor update of Xcode (and updates to the compiler, that is).
I'm working on the commercial available PSPDFKit SDK for both iOS and Android. We're actually using a lot of C++ internally since raw performance is very important and Objective-C (and for many things, also Swift) are not yet fast enough for certain tasks.
We did invest a lot of time in adopting the latest Objective-C features such as nullability and generics next to declarations such as noescape for block-based API to make our SDK great to consume from within Swift.
While a separate Swift-wrapper could offer additional convenience, you'll find it very simple to use, and we're always working to adopt more features that improve bridging as they come available - there are a few interesting things in the Swift 3 proposals.
If you do not want to go the framework route, you can use CGPDFScanner to base a custom text extraction engine on. You will need to read up on Character Map Parsing - Page 446ff and many other sections - extracting text from a PDF document is surprisingly difficult, and after much work you'll be left with individual glyph positions and need to approximate where words are and if the document uses spaces or if you need to synthesize your own to correctly extract text. It's something that just takes a lot of experimentation and approximation to get right.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am wondering if it is possible to make a completely new format. Mac use a .text file for text and .mov for movies so is it possible to make a new format that i can put into a iOS application that it will use off and export off, for example the application pages exports a .pages file, and if so what is a good tutorial site or script that u can use.
A few thoughts:
File extensions
If this is just a file that your app uses internally, it doesn't matter too much what extension you use. Use whatever you want.
If you're going to be sharing files, however, you should ensure that you pick an extension that you're confident is unique. For example, it looks like RCB extension is used by Easy Resume Creator Pro (I don't know it, but that's what a quick google of that extension reports).
How to do it.
I'd simply advise you refer to How to Import and Export App Data on Ray Wenderlich's site, which describes how you can define a UTI for your app's data files. Also refer to this Stack Overflow answer.
How to store the information.
In terms of how to store the data in the file, you can obviously do whatever you want, but I'd encourage you to consider, if dealing with text data, using an established format (even if you're using your own custom extension). For example, if dealing with simple Cocoa objects like arrays or dictionaries of strings, numbers, dates, etc., I might suggest using a property lists (see Apple's Property List Programming Guide which writes data in an XML format.
Alternatively, if using your own NSObject subclasses, you can use a binary property list format as enabled by NSKeyedArchiver and NSKeyedUnarchiver which are discussed in Apple's Archives and Serializations Programming Guide.
There are lots of other formats that are open to you, but these two approaches take advantage of well established interfaces for reading and writing data and can be done with a minimum of effort
Alternatives to new file format.
Depending upon precisely what you're trying to do, if you're exchanging trivial amounts of information, a custom URL scheme might be sufficient. This bypasses the issue of dealing with custom file formats and enables a few other workflows.
Hopefully this is enough to let you start researching the different alternatives.
This question already has answers here:
Use CoreData or SQLite on iPhone? [closed]
(3 answers)
Closed 9 years ago.
This is for an iphone app. What's the best route that I should take? I have data and I would like to have it in my app and access it throughout the app in different ways search, title, state, etc.
I don't want the user to be able to modify it or delete it.
Should I use core data or SQLite or is there a better way?
Thank you
I personally would recommend using CoreData for its ease of use. CoreData, in fact, act as an abstraction layer over SQLite so, you don't need to actually write any SQL lines.
Take a look at the CoreData documentation from Apple so you can understand exactly what it is. Or, maybe, you can jump to their Tutorial for a "hands-on" explaining:
Core Data Tutorial for iOS
Also, I personally like to use tutorials from the Ray Wenderlich sites, like this one:
Core Data on iOS 5 Tutorial: Getting Started
(by the time of writing this, the Ray Wenderlich's site is under maintenance.. but check it out later.. it is pretty good!)
better-performance-with-libxml2-or-nsxmlparser-on-the-iphone
I've read that question and the answer about comparation of XML parser on iOS Apps Development. Well, actually i don't get what the point is.
My questions is, if I want to get and load huge XML data on my apps, larger than 200kb, what the best I could use..? is it NSXMLParser or libxml2..?
btw, I'm using Xcode 4.2 on iOS 5
I have used this resource in the past:
How To Choose The Best XML Parser for Your iPhone Project
The post summarizes the differences between a number of different XML parsers for iOS.
What's wrong with the accepted answer to that question?
Basically, #zPesk says :
libxml was found to be a bit faster but harder to use because it's in C instead of objective-c.
I don't think it matters that much as long as you use SAX parsing instead of DOM parsing - the last thing you want to do with an XML document that big is to load it into memory all at once!