Issue setting data for Radar Chart in iOS charts - swift

I am using the charting library here https://github.com/danielgindi/Charts/ however I am having a couple of issues.
First, I have no idea how to set the data for a radar chart type and second, I have an error when apply the RadarChart to uiview. The error is
Unknown class RadarChartView in Interface Builder file.
The app still runs and I can see an empty uiview.
I have looked at the demo app and through the documentation but I am still unsure how to actually set any data to the chart.
Thanks

If you looked at ChartsDemo app, why you still not unsure how to use it? The code is straightforward. Otherwise I am still copy pasting code from ChartsDemo, which is meaningless.
For the class, you need to choose Charts module for your IB: https://github.com/danielgindi/Charts/issues/59
downloaded library
reembedded it with the option "Embedded Content Contains Swift Code"
In Storyboard where I defined the class for the charts view as "LineChartView", I also have to set the module manually to "Charts".

Related

why cant it detect FSCalendar in Swift

first of all, im a very newbie to Swift language, I believe, FSCalendar is properly downloaded under my project, but when trying to use the class, it doesn't detect on custom class.
First, I created podfile and add pod 'FSCalendar' on it, and did pod install and everything seemed to go under the project.
second, I dragged and dropped FSCalendar to the project as it seems in the image below and made a view under main view defining custom class 'FSCalendar' and it just shows the FSCalendar designable,
every FSCalendar related classes display on drop down option of custom class, but it just doesnt detect it.
I would appreciate your help in advance, ive been struggling with the initial setting so long
thank you.
here is a screenshot of xcode screen
So this is due to the fact that when you do pod init it creates an .xcworkspace file which you should now be using. This has a similar symbol to the normal .xcodeproj file you'd normally open, except its white, here's a screenshot of what it should look like:

Custom control within framework not configurable or visible in Xcode

I have created a small selection of custom controls that are tagged #IBDesignable to enable visual configuration within IB. They work perfectly in their parent project/workspace and, as I wanted them to be reusable, I've created a framework.
After importing the framework into another project, I can access the classes programmatically but there is no visual representation in IB and none of the #IBInspectable properties are displayed in the attributes inspector. There are no errors reported during build or run phases. I guess I'm missing something somewhere but does anyone have any pointers?
It would appear that this is not currently possible (using Carthage as a dependency manager at any rate) without considerable effort with workarounds. This kind of defeats the object IMO!
For now it seems that you need to import the framework project into the product project. Explanation here but, for now, this seems dead in the water.

XCode wont let me use a Static Library View in my xib files

I created a new project of type Static Linked Library.
I have moved the code (previously working in the app) to the library leaving all the xib files in the app.
I have changed the export directory and added the library file from the derived data folder so it gets the compiled version and links to it.
I have added the library to the bundle and have verified it is in the app using iPhone Explorer
I have verified that the xib file recognized the new view type by removing and selecting the custom view type in the custom class field of the identity inspector.
I have changed all of the #import commands to reflect the <> VS "" change and have gotten the app to compile.
however none of the methods of my custom class can be executed. and an NSLog reports that the class is its base counterpart as opposed to the custom derived class.
I am at a loss and have spend a long time converting all the code I have to work in a library. I am hoping someone can help with this.
On this issue, it turns out that Objective C's compiler does not load the categories and custom classes in the libraries by default. There are 2 ways to overcome this.
And here are your options.
Create an Activation type method on the category that will be called to "Activate" that Class or Category. This will need to be done before the application loads any nib files. And seems like a bit of a pain in the butt. This was however how I originally overcame this issue.
Add linker flags that will tell objective C to load all libraries and attach any and all Categories and Classes within the libraries before executing the application. (this will need to be done, on top of #import(ing) the correct files from their correct locations. I will provide a graphic below. and provide the flags for search purposes
-ObjC is the first one I added, but -all_load really did the trick.
I hope that others can benefit from this experience.

iOS - QuickLook - How to open an object in QuickLook without a UIScrollView

Could anyone point me towards a resource which uses QuickLook to open a (preferably but not necessarily a pdf) file without using a UITableView?
I do have this example of using QuickLook but it uses a listview which I need to get away from.
http://robsprogramknowledge.blogspot.com/2011/02/quick-look-for-ios_21.html
I'm not sure how you plan to design your UI to open a file. I've used a few different ways, so I'll toss out some ideas. A UITableView is ideal for large amounts of files. A generic scroll view can also be used for a large number of files. I've used an alert view for an app that only generates one or two files. You could also use a view with document icons like the iPad Mail app. To get the document icons, use UIDocumentInteractionController. The WWDC 2010 DocInteraction sample code goes in great depth with how to use UIDocumentInteractionController.
As for opening the file, the Quick Look framework makes that easy. A simple, self-contained solution is to subclass QLPreviewController. Then, your subclass needs to conform to the QLPreviewControllerDataSource protocol and optionally the QLPreviewControllerDelegate protocol. Next, pass it an array of NSURLs pointing to your files. You can do this either through an initializer like -initWithFiles:(NSArray *)files or through a setter. From here, -previewController:previewItemAtIndex: just needs to index into the array to get the appropriate file to show. -numberOfPreviewItemsInPreviewController: just needs to return the size of the array. Once you have this class finished, you can use any UI design you like to push this view or present it modally.
Hopefully this is more clear than my tutorial you've been reading.
EDIT:
I have posted some code to Github that may help you. I have created a file previewer class as described above. I also posted a demo app that directly uses a QLPreviewController.

Iphone sdk - How to setup a 'template'

I've been working on a Cook Book App and I've been making each page individually which takes a really long time to do, I asked a question similar to this and it was brought to my attention that you can setup a way to automate the design process so all you need to do is input your data.
Can someone please explain in as much detail as possible how you setup your xcode files/code to automate such a process
So for example I would just enter the page text and it would automatically put my standard background picture in and add a scroll view and appropriate buttons etc.
Thanks
You could make one master view that contains all the controls that you need: standard background picture, scroll view, appropriate buttons, etc, and make any subsequent views that you create inherit from this view, so that they all contain those controls.
You could also use just one view and work with multiple instances of it, one instance per page. Just make sure to have a Text property on it, or a constructor that takes in your text string, so that you could set it to a different text on each page.
Xcode project templates and file templates are pretty easy to make, with a few caveats.
Check the answers to these questions:
Add new templates in Xcode
Change templates in XCode
Also take a gander at these handy tutorials:
Custom Xcode Templates
Xcode: How to customize the existing project templates
It sounds to me like your putting your data into your views (pages). That's a big design error. You need to employ the Model-View-Controller design pattern and separate your data from your views. That will make it easy to create one view (template) that you can reload with data to display each individual recipe.
The first thing to do is to separate your data from the view. You need to have the recipes stored in an array, dictionary, Core Data etc and then wrap that data in a dedicated object. The second thing to do is to create a dedicated view to display all the recipes. As the user moves from recipe to recipe the app will simply remove and add information to the same view as needed.
I would recommend Cocoa Recipes for Mac OS X: The Vermont Recipes, Second Edition because it addresses these issues and it uses a recipe type app as its example. It's for Cocoa but the basic principles apply to iPhone apps as well.