Saturday, 18 July 2015

july 13

This post helped me understand that when using custom accessors the system will not complain. But the lack of complaint does not mean that things will work correctly.
"CoreData NSManagedObjectContexts use Key-Value Observing to track changes to the in-memory objects they own. They do this through the normal KVO mechanisms, though in some cases they leverage the runtime in unusual ways to accomplish this (which is why CoreData does not always play well with Swift).According to the documentationNSManagedObject subclasses do not automatically send KVO notifications for modeled properties. This may no longer be accurate, and is easy to verify if you are interested. For the most part it is irrelevant - if your application is interested in key value observing notifications for objects you control implement+automaticallyNotifiesObserversOf<Key> to emit automatic key value notifications for synthesized accessors.If you implement your own accessor methods for NSManagedObject properties (not...really...recommended...) you MUST ensure that the key value observing notifications methods are called at the appropriate times (willChangeValueForKey:/didChangeValueForKey:) in addition to the relevant CoreData specific methods (willAccessValueForKey:/didAccessValueForKey:). If you do not do so the internals of CoreData will not reliably track changes to those properties. And that would be bad.When a managed object instance changes the context that owns it sees the change via KVO and adds it to the internal change tracking of the context. These changes are coalesced, and when the context is saved the changes are committed.” -quellish
April 23 

Useful command
Control-Shift-Alt-v for pasting text without formatting. 

Some notes in the form of questions 

2. Give an example of using the CGRectInset method. Give 3 example arguments for it and the output that would be generated. Give an example of input that would result in the output being an empty rectangle. 

3. How do we search for an image in the assets folder with a particular name and do something based on the result of that search?

4. What two commands allow a Bez path to be drawn after it has been set up?

5. What counts as custom drawing on a view? What method would be used to manually force a redraw of the custom drawing on a view (Hint: it does not involve calling drawRect)? 

6. The method that gets the current drawing context. 

7. Describe 2 ways that images can be stored in the model. One way should involve the view being redrawn 

8. Give the 3 ways that a gesture recognizer can be added to code.