Closed Obbut closed 7 years ago
Turning access level into regular NSObject subclass as every other model we have would be fine, I'll need to be able to persist that regardless of a templating engine we use as I want to cache artifacts.
If you want to submit PR for that, it would be awesome :) You'll need to add markup as we do for other nscoding items and run sourcery on itself (using latest release binary) and then find Sourcery -name \"*.swift\" | xargs ./Scripts/update-placeholders ./Sourcery/CodeGenerated/Coding.Generated.swift
PS. My general recommendation is still to use Stencil rather than Swift templates, they are very much an early prototype in situations where there is no way to express something in Stencil (really rare).
Let me know if you want to try implementing that fix
Maybe we can just encode/decode rawValue?
We could but then we'd need to add support for that to the coding template, NSObject would be more consistent with general architecture
I'll adjust this, thanks for report @Obbut
Actually much simpler, I forgot we don't really use AccessLevel outside of Method (which I missed), we only store rawValue of it anyway, so just updating method should fix the issue, we can optimize it for swift templates in the future but for now just to make it consistent in both templating engines I'll update to String as its everywhere else /cc @ilyapuchka
I've been playing with Sourcery a bit together with @Joannis and we have been following your progress quite close. Trying to play with the Swift templates in 0.5.2, we couldn't get them to work due to the following exception:
2017-01-10 09:25:13.513 Sourcery[44543:41067027] -[_SwiftValue encodeWithCoder:]: unrecognized selector sent to instance 0x7fb84f532e10
This actually happens because of this line in Method.swift, which tries to encode the
AccessLevel
enum using NSCoder. However,AccessLevel
does not conform toNSCoding
, which is a class protocol.I don't really know how you guys would like to fix this, so that's why I'm opening an issue instead of submitting a pull request.