Missing boilerplate method implementations with Xcode 4.5 - xcode

I'm following some xcode lessons that are using xcode 4.2 while I'm using xcode 4.5.2.
In those lessons when a new project is created i can see that there are a lot of built in methods in the ViewController.m like ViewDidAppear etc'. In my ViewController.m there's online - viewDidLoad and didReceiveMemoryWarning
Is there a way to get that behavior back or there's something I'm missing in 4.5.2 ?

You aren't missing anything.
Xcode't templates tend to evolve with releases so things come and go. One of those things was all the boilerplate that you used to get with view controllers.
The good news is that you are aware that they are missing so you know which ones to put back if you need to implement them.

Related

How to setup and use a GitHub framework in Xcode without CocoaPods

I am trying to add in various github frameworks into my app. I am new to this and I am not sure exactly how to do this.
For example if I want to add the following from github https://github.com/Awalz/SwiftyCam
I do not want to use CocoaPods and I simply follow the section for manual, how do I incorporate this into my app and actually get using the camera.
So far I have dragged in the files from the source section and placed it into my Xcode project.
Now I have created a new viewcontroller in storyboard and made it fit to the custom class of swiftycam.
Here is where I get confused as to how I proceed, and I am not sure if I have done everything up to here correct.
If someone with experience in this can show a step-by-step it will be greatly appreciated for this and all future GitHub frameworks I wish to add.
Thank you!

Why does xcode's NSManagedObject generated subclasses miss methods for working with to-many relationships

In Xcode 8 Apple will update Xcodes abilities to generate NSManagedObject subclasses. But xcode will still not add methods for adding or removing objects to/from to-many relationships. Why is that? What am I missing. Does anyone know if this is deliberate from Apple, or just a missing piece of functionality?
Talking about swift generated subclasses. The obj-c version gets the methods.
It's clearly a bug. Right now we're at Xcode 8's first public beta, and bugs are expected. Please go to http://bugreport.apple.com/ and report it. I reported it (rdar://27071943 in case anyone from Apple sees this), but more reports mean that it's more likely to be fixed.

Swift Xcode debug auto complete

I have been porting an app from Objective C to Swift. In Objective C I get autocomplete in the Xcode debug pane as shown. However, the Swift version does not. I may be missing something simple but after working around this for a few months I give up. Attached are relevant screenshots (top is Objective C).
I realize this may not be a language specific feature but how do you get debug autocomplete functionality in Swift like Objective C?
Try the control+Space combination forcefully at locations. Sometimes it helps.
There's also this link I found. maybe it could help:
XCode 6 isn't autocompleting in swift
Answer is late, but I want to see my answer more people for this situation.
This is not Xcode Problem. Erasing Derived data is just temporary work.
I guess you are included by one of them
Your application is support Above iOS 7 (not iOS 8)
Use Cocoapod or 3rd party app
Autocomplete is not working when you develop with swift above iOS7. Swift did't recommend to use static lib, but iOS7 support only static lib not dynamic lib.
(see this post https://blog.cocoapods.org/CocoaPods-0.36/,
http://corinnekrych.blogspot.kr/2015/04/how-well-does-swift-plays-on-ios7.html)
Change your project to iOS 8
Cocoapod will need use_frameworks! if you want to support dynamic lib.
If you use dynamic link, You don't have to write header in Bridge_header. Import it in Swift file like Import UIKit
One more trick is just clean your Project will make Swift Auto complete, but after rebuild, you can't use auto complete.

Tutorial/example of a minimal document-based app

I'm trying to understand how the things in Cocoa works but I'm struggling with one thing. I saw http://cocoawithlove.com/2010/09/minimalist-cocoa-programming.html and http://casperbhansen.wordpress.com/2010/08/15/dev-tip-nibless-development/ and I think I somewhat understood.
Now, I would like to do the same but for a "Document-based application". Please, does anyone know of a tutorial or example akin to the ones above? Alternatively, what do I need to do to make it work? I think I need to create NSDocumentController - but how does it relate to NSApplication? And I create NSDocument from there? Frankly, I'm bit lost...
That was me six months ago! I did not find a decent tutorial either but started with a new project using the default Xcode project template:
I started out with the setup Xcode generates for you when you start a new project and implemented piece by piece as I went along. There's some good reading here on Stackoverflow about the use of the various controller classes but here's what I did:
The document class, generated by Xcode, is my top level controller. I do not use NSDocumentController.
Each use case of my app has a number of NSViewControllers which manage the various views of the use case. These controllers are dynamically swapped in and out. The top level controllers are managed by the NSDocument class (NSPersistentDocument in my case as I use Core Data).
I am by no means an expert, so I stand corrected for better approaches but so far this setup has been easy to work with, easy to maintain and easy to extend.
Note: Using Core Data is optional but over time I've come to love it and think it's very powerful and a huge time saver. When you decide not to use Core Data, the above setup will still work but you will have to manage your own data.
EDIT: This post explains the relevance of NSDocumentController.
EDIT2: This one from Apple is an interesting read as well.
EDIT3: You do need NIBs (or XIBs as they're now called) as they contain the UI of your app. You pull them in via a view controller (subclass NSViewController):
NSString *aControllerName = [anIdentifier stringByAppendingString: #"ViewController"];
NSString *aNibName = [anIdentifier stringByAppendingString: #"View"];
Class aControllerClass = NSClassFromString(aControllerName);
[self setCurrentController: [[aControllerClass alloc] initWithNibName: aNibName bundle: [NSBundle mainBundle]]];
In the above anIdentifier could be Department, which would instantiate the DepartmentViewController and load the XIB name DeparmentView.
You can use plists to store your data but that's not a requirement. There are many ways to store your apps data. You'll have to read about the various architectures Apple has in place and make your own choices.

How to check for the details of components in interface builder in XCode?

i am quite new to XCode. I was looking through some of the sample codes from Apple Developer sites. I understood code for the same but I am not having a clear idea on how to check for the type of components used in the application and how they are linked with the .m and .h file.
Can anyone help me with how interface builder connects to .h and .m files and how I can check that for the project that I have not created?
Thanks
I did not like the source codes given in apple developer site because it seemed pretty complex to me when I started learning..
try this site out http://blog.webscale.co.in/?p=143
It will give you a basic idea of how to get started with adding components and everything else.
I would also like to suggest that you dont use interface builder for adding components but rather add them using code... it would give you more flexibility... ( but thats just my suggestion)...

Resources