Comments (12)
I'm down with that, implementing it the way your described. I'd accept such a patch if you want to work it up. :-)
from mogenerator.
Cool. I could try, but won't have time for a few weeks. I wanted to at least get the ball rolling with this bug entry.
So how about key 'attributeValueSetterSemantics' where the value can be 'retain' or 'copy', and if there's no value it defaults to retain?
from mogenerator.
I know about the busy thing :-) attributeValueSetterSemantics
sounds fine.
from mogenerator.
Sounds like #84 supersedes this issue? Should I close it?
from mogenerator.
I don't think they're the same, but certainly related.
Regardless of memory model, there is a difference between copying and referencing an object.
It could still be useful, IMHO, it be able to tag an attribute as either 'copy' or 'retain aka strong'.
from mogenerator.
Here's a first shot: https://github.com/diederich/mogenerator/tree/propertiesWithCopy
Instead of allowing to define retain/copy in the userInfo dictionary, this approach uses a boolean value. I'm not sure if this is a good approach, but it works for the above example, as "strong" implies copy. Though others like weak, __unsafe_unretained might be interesting for the PONSO templates.
My current use case for this is an NSManagedObject which should implement a protocol that defines a property with copy semantics.
from mogenerator.
What do the two states of your boolean represent? What do you mean "strong implies copy"?
from mogenerator.
The state says either to use copy semantics or not.
If it's set to yes, the property is declared as
@property (nonatomic, copy) <Type> <Name>;
if set to no it's dependent on ARC. If ARC is enabled it's
@property (nonatomic, strong) <Type> <Name>;
without ARC it's
@property (nonatomic, retain) <Type> <Name>;
So there's no special case for ARC and copy. If you declare a property as with copy semantics, strong is implicitly added (http://clang.llvm.org/docs/AutomaticReferenceCounting.html#ownership.spelling.property)
from mogenerator.
I think you meant to say "copy implies strong" not "strong implies copy".
from mogenerator.
Definitely, thanks.
from mogenerator.
related: #84
from mogenerator.
This is ancient. Closing it out. If its still an issue for you, please open a new issue.
from mogenerator.
Related Issues (20)
- Add nullability annotation for primitive setters HOT 2
- scalar methods do not respect the signed types that Core Data forces
- Swift generated code creates NSNumber for boolean types HOT 1
- Generated code crashes with Xcode 8.3 HOT 3
- Issue with setPrimitive...: for Transformable attributes HOT 1
- Inherited entities and compundIndex
- RFC: Swift Codable Attribute Support HOT 6
- Changes on swift42 break `attributeValueScalarType` for enumerations HOT 4
- Implement Codable support for NSManagedObject subclasses HOT 13
- Use scalar properties for primitive data types HOT 3
- generate NSFetchRequest without executing it HOT 3
- There is mo mogenerator's folder in /Library/Application Support after successful installation. HOT 2
- Trying to find swift template files outside of template-group HOT 8
- Attribute's userInfo dictionary HOT 1
- Feature Request: MacPorts support HOT 1
- Swift module name breaks things HOT 1
- Wiki for Template Variables - abstract should read isAbstract
- Is this project maintained? HOT 1
- Transformable property for [NSString] get error.
- mogenerator --configuration does nothing now HOT 1
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 mogenerator.