Comments (9)
Ok I fixed it.
You should maybe edit your README.md from:
(response: WeatherResponse?, error: NSError?)
to:
(response: Result< WeatherResponse,NSError>)
from alamofirexmltoobjects.
Ok last comment (I swear :D ) I also got that to work.
Last I have some general comments to the lib.
In my case I had to define a __name var for a tag that didn't had any properties it now stores the name of the tag don't know why that there don't have it in any other case.
It would be nice if the whitespace would be removed automatically so you don't have to write the underscore in front of every property.
But all in all I'm really happy that I didn't had to write such a lib by myself. So at the and a big thanks! Will recommend it!
from alamofirexmltoobjects.
First I'm really thankful you replied that fast (or at all) !
After updating the Podfile (don't wonder it's a .txt couldn't upload it otherwise) I got the example project to work.
Podfile.txt
I'm still wondering why it throughs that error in my project, because I installed the same dependencies.
Podfile[custom].txt
If it helps I could add you to the repo I'm trying to install it on.
from alamofirexmltoobjects.
If you download AlamofireXmlToObject (press download zip at https://github.com/evermeer/AlamofireXmlToObjects) and then execute a pod update from the terminal you should see that the folowing 2 library versions are loaded:
- Alamofire (3.4.0)
- EVReflection (2.31.0)
After that you should be able to run the tests
from alamofirexmltoobjects.
Other question how do I represent properties of tags in a class ? Which datatypes do I use ? For example I have the following xml tag:
<device name="HM-CC-RT-DN KEQ0652567" ise_id="1237" unreach="false" sticky_unreach="false" config_pending="false">
from alamofirexmltoobjects.
Ah! yes, the signature was changed quite some time ago... I will update the sample in a moment.
In your sample you will get a sub object for device. That device sub object will have a _name, _ise_id, _unreach, _sticky_unreach and _config_pending property. attributes will get an underscore in front of the name.
You can see how this works in the test that you can find here:
You could also just define 1 object without properties and run it. In the console log you will find warnings that specific properties could not be found. Then just add those properties to your object.
from alamofirexmltoobjects.
The __name and the _ for attributes comes from the XML2Dictionary library. That is a library that is not written by me.
AlamofireXMLToObjects itself has a very limited implementation. It's only a bridge between XML2Dictionary, AlamoFire and EVReflection. See here the entire code of the library. See how small it is? AlamofireXmlToObject library It's only 70 lines of which half is comment.
from alamofirexmltoobjects.
Ok I didn't knew that I relatively new to swift programming and therefore don't know many of the common libs. Normally I'm working in C++, C, PHP, Python and some other Web languages.
from alamofirexmltoobjects.
Tip: EVReflection supports property mapping. You can use that to ignore properties or to change a property name. For instance you could Implement something like this:
override public func propertyMapping() -> [(String?, String?)] {
return [("__name", nil), ("_name", "Name"), ("ise_id", "IseId")]
}
You could also put that in a base class so that it's used in all your objects.
in the case above the __name will be ignored and _name will be changed to Name
from alamofirexmltoobjects.
Related Issues (10)
- "not key value encoding-compliant" problem HOT 4
- Array of an dictionary(In dictionary again there is a dictionary) evreflection?
- Unable to parse and extract data HOT 24
- Unable to Parse HOT 1
- Issue - #4, Unable to Parse HOT 1
- fatal error: NSArray element failed to match the Swift Array Element type HOT 6
- swift 3 issue HOT 2
- How to display XML Content as String? HOT 1
- Generic type 'Result' specialized with too many type parameters (got 2, but expected 1) HOT 2
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 alamofirexmltoobjects.