Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Edwin Vermeer
    @evermeer
    I do have to fix one (unrelated) unittest before I can push it to GitHub.
    Edwin Vermeer
    @evermeer
    @eXhausted I have pushed the EVManagedObject fix to GitHub as version 4.17.0
    Enrique Choynowski Melgarejo
    @Enriquecm
    Hello @evermeer

    Is it possible to have more than one Date Formatter? because my service has two different date formatting.

    1 - yyyy-MM-dd'T'HH:mm:ss.SSSZ
    2 - yyyy-MM-dd'T'HH:mm:ssZ

    And I can't handle this with just one DateFormatter.

    Edwin Vermeer
    @evermeer
    @Enriquecm At this moment you can only do that by using a propertyConverter for one of those dates. It was already on my mind to think of a more flexible solution for this but since there was no demand for it yet it’s still low on my todo list. I can think of one reaslonably easy fix for tis and that is that you could specify per object if you want to overrule the default date formatter. Or do you have multiple date formats in one object? Anyway… For now you should implement a propertyConverter like this:
    override open func propertyConverters() -> [(key: String, decodeConverter: ((Any?) -> ()), encodeConverter: (() -> Any?))] {
        return [( // We want a custom converter for the field isGreat
            key: "isGreat",
            // isGreat will be true if the json says 'Sure'
            decodeConverter: { self.isGreat = ($0 as? String == "Sure") },
            // The json will say 'Sure  if isGreat is true, otherwise it will say 'Nah'
            encodeConverter: { return self.isGreat ? "Sure": "Nah"})]
    }
    But then of course while converting to and from a date instead of a boolean like this sample.
    Enrique Choynowski Melgarejo
    @Enriquecm
    @evermeer I got it.! I'll keep an eye on your repository. Anyway, thank you very much for the reply. I believe the propertyConverters will work.
    Guilherme Araújo
    @guilhermearaujo
    Hi, how can I use EVNetworkingObject when installing EVReflection via Carthage?
    I'm including the EVReflection.framework, but the compiler says Use of undeclared type 'EVNetworkingObject'
    Edwin Vermeer
    @evermeer
    @guilhermearaujo EVNetworkingObject is part of the Alamofire subspecies. Currenly there is no Carthage framework configured for that. There is only a Carthage framework for the base EVReflection.
    parkesb
    @parkesb
    Hi @everemeer, I just upgraded to swift 4 after a break and now no data gets loaded (was working in swift 3). I'm getting a "The class is not key coding compliant for the key". Keys are all basic types e.g. String. Source data is a JSON Dict. Any ideas what I'm doing wrong?
    parkesb
    @parkesb
    Found the issue @objcmembers was commented out in the cocoa pod version
    Edwin Vermeer
    @evermeer
    @guilhermearaujo I was unable to push the Swift4 version which is now on master to cocoapods because of the dependency with Moya which is still in beta for the Swift 4 version. So when you do a pod update you will get the version without @objcmembers. The moment Moya 10 is release I will push the master branch to cocoa pods.
    parkesb
    @parkesb
    Got it and thanks for the response - it's all working now.
    Hardik
    @hardikdevios
    @evermeer Hey Mate i can see that you have released the SWIFT 4 version but cocoapods still pointing to 4.19.1
    can you please please update that ?
    Edwin Vermeer 
    @evermeer_twitter
    @hardikdevios There is a problem publishing it to cocoapods because of a dependancy with Moya which does not have published its swift 4 version. If you add the gitpath in your podfile then it will be forced to the 5.0 version.
    pod 'EVReflection', :git => 'https://github.com/evermeer/EVReflection.git'
    Hardik
    @hardikdevios
    @evermeer yes i am already doing that and watching this repo since SWIFT 4 release, Regarding Moya i think they have updated with SWIFT 4 https://github.com/Moya/Moya/releases
    Edwin Vermeer 
    @evermeer_twitter
    Ah, thanks! Will have a look at it later today
    King Calculator
    @KingCalculator_twitter
    @evermeer_twitter does evreflection supports generic types? Im doing something like class SomeClass<T: EVObject> { init() { let t = T(json: somejson) }. the EVObject() init is invoked, but the values that the class behind the T generic are not valid... any idea why?
    King Calculator
    @KingCalculator_twitter
    when i print the object it prints fine, maybe it's an xcode issue
    Edwin Vermeer
    @evermeer
    @KingCalculator_twitter Yes, there is support for generics. You do have to implement 2 functions to make it work. You can find a sample in these unit tests: https://github.com/evermeer/EVReflection/blob/ec78dbae21aa30794231c516bb74447bc04d0cfe/UnitTests/EVReflectionTests/EVReflectionWorkaroundSwiftGenericsTests.swift#L123
    King Calculator
    @KingCalculator_twitter
    thanks
    King Calculator
    @KingCalculator_twitter
    @evermeer what about json data that has an array as it's root object? since array does not inherits EVObject/EVNetworkingObject it can not be used with DataResponse<T> ....
    King Calculator
    @KingCalculator_twitter
    nm, found requestArray
    amgadserry
    @amgadserry
    hey guys how can i achieve 1 to many relation with class of the same type in EVManagedObject ex.
    class Person: EVManagedObject {
    @NSManaged var name: String?
    @NSManaged var friends: [Person]?
    }
    Edwin Vermeer
    @evermeer
    @KingCalculator_twitter When the root is an array, you can just instantiate an array like this: [ MyGenericObject < NSString > ] (json : json )
    And when using Alamofire you can use the .responseArray instead of the .responseObject function
    Edwin Vermeer
    @evermeer
    @amgadserry The problem there is that EVReflection is not able to pass on the context from the Person object to the Person objects in it’s friends properties. You have have to do that yourself by implementing the ‘setvalue forKey’ function for the friends key and then create a new array of Person objects with the right context and set that to the friends property.
    amgadserry
    @amgadserry
    @evermeer well the problem is that EVManagedObject does not provide empty constructor by default to create Person instances with it needs a context and if i passed the context of my coredata instance then it will add the friends array as siblings to the original entities as well as children so how can i deal with that can u provide some example code
    Art-Cube
    @Art-Cube
    Hi, I've got a number of classes which are EVObjects and are populated via downloaded json data. I've been asked to persist the objects in Core Data. Is there a simple way to do so, or do I need to create the NSManagedObjectModel either vis Xcode or by code? I'm hoping there is some way to dynamically create the model from the objects themselves.
    Mike Manzo
    @MikeManzo
    Greetings … I am having (what I think is) a memory leak issue with class inheriting from EVObject. When I decode from serialization, I am getting a memoy leak indicator here:
    if !(value is NSNull) {
    var setValue: AnyObject? = value as AnyObject?
    try anyObject.validateValue(&setValue, forKey: key)
    anyObject.setValue(setValue, forKey: key)
    }
    Sorry … hit return too early on my last message … anyway, I do not have a custom validator and my object is quite sparse. I was wondering if anyone else has experienced this issue … and whether it’s really an issue? Thanks in advance!
    Mike Manzo
    @MikeManzo
    Issue fixed in 5.6.2! Thanks for the help!!
    nadirozgurler
    @nadirozgurler
    Greetings … I am having problem with realm List object, I am getting error, ERROR: Could not create an instance for type
    dict:{
    code = 4004;
    domain = "users-api->mobile-aggregator";
    location = mernis;
    locationType = mernis;
    message = "Ad, soyad, T.C. kimlik ve do\U011fum tarihi alanlar\U0131na girdi\U011fin bilgiler uyu\U015fmamaktad\U0131r. Bu bilgiler n\U00fcfus c\U00fczdan\U0131ndaki bilgilerle ayn\U0131 olmal\U0131d\U0131r. L\U00fctfen kontrol edip tekrar deneyebilir misin?";
    }
    class BaseModel: Object, EVReflectable { } class BaseResponse: BaseModel {
    let errors = List<ErrorResponse>()
    @objc dynamic var status: StatusModel? = nil
    }
    class ErrorResponse: BaseModel {
    @objc dynamic var domain: String = ""
    @objc dynamic var code: Int = 0
    @objc dynamic var message: String = ""
    @objc dynamic var location: String = ""
    @objc dynamic var locationType: String = ""
    }
    I have add to my pod file that pod 'EVReflection/Realm'
    nadirozgurler
    @nadirozgurler
    here is my json response, { "status": { "code": 400, "message": "Sms şifreni girmedin. Doğrula butonuna basarak yeniden şifre isteyebilirsin." }, "errors": [ { "domain": "users-api->mobile-aggregator", "code": 4019, "message": "Sms şifreni girmedin. Doğrula butonuna basarak yeniden şifre isteyebilirsin.", "location": "code", "locationType": "field" } ] }
    Jason Froehlich
    @jayfray07_twitter
    I have an EVObject which in turn has an array of EVObjects as a field. When the parent object gets encoded to JSON I want to omit certain objects from the Array. Where is the best place to do this? Should I use propertyConverters?
    Aviran Abady
    @AviranAbady
    Hey @evermeer does EVReflection/Alamofire responseObject() supports Boolean types? For some reason they are 'paresed' to null...
    Maulik shah
    @iammaulikshah_twitter
    hello
    unable to insall EVReflection
    It's too bad
    try using pod
    added in pod
    pod 'EVReflection/Alamofire'