Is there any class in MvvmCross that inherits from ActionBarActivity? - xamarin.android

I'm developing an App with Xamarin.Android (aka MonoDroid), using the great MvvmCross Framework. The application uses Fragments, and need an ActionBar.
I've noticed that the MvxFragmentActivity inherits from MvxEventSourceFragmentActivity, and this last inherits from FragmentActivity, which has no ActionBar support. To support ActionBar, i need a class that inherits from ActionBarActivity, wich is included in the Support Library, and inherits from FragmentActivity.
So, my question is: Is there any MvvmCross class that Inherits from ActionBarActivity?
If not,
Can I just create a MvxEventSourceActionBarActivity and a MvxActionBarActivity that inherits from the first one, with just the same code of the MvxEventSourceFragmentActivity and MvxFragmentActivity just changing the inherits?

The basic answer is "No. There's no existing class. But I f you want to add binding to any Activity, then you can do so using 2 layers of inheritance - adding first an eventsource and then an Mvx layer"
There is a bit more detail about this in a few questions - eg ActionBarSherlock with latest MVVMCross
For the latest android support library, there is one issue to be aware of currently - when building binaries you currently either have to choose the mono library which gives you compatibility with play services or you have to choose the new Xamarin component which gives you the latest support lib - see MvvmCross - trying to use Fragments AND latest support lib results in linking problems and https://bugzilla.xamarin.com/show_bug.cgi?id=15205

Related

How do Framework and Static Library differ for inversion of control in iOS?

In one of the answers for a question on iOS Framework vs. Static Library, yoAlex5 quoted,
A Library is essentially a set of functions that you can call, these days usually organized into classes. Each call does some work and returns control to the client.
A Framework embodies some abstract design, with more behavior built in. In order to use it you need to insert your behavior into various places in the framework either by subclassing or by plugging in your own classes. The framework's code then calls your code at these points. The main control of the program is inverted, moved away from you to the framework. (Inversion of Control)
Could anyone please give any example for iOS with minimal code snippet where I can understand how Static Library cannot support inversion of control when a Framework can?
In the accepted answer to the question that you cited, the following is mentioned:
Hence on iOS, your only option is basically to use a static library or
static framework (the main difference being that a static framework is
distributed as a compiled .a file most often, whereas a static library
may simply be included as a subproject - you can see all of the code -
which is compiled first and its resulting .a file used as a dependency
by the project).
So the main difference on iOS actually is that normally a framework is used in compiled form, whereas a library is used as code. Therefore both support in principle inversion of control.
However, even if everything a framework can, could also be provided by a library, one should definitively restrict certain functionality to frameworks. Wiki says:
Frameworks have key distinguishing features that separate them from
normal libraries:
• inversion of control: In a framework, unlike in
libraries or in standard user applications, the overall program's flow
of control is not dictated by the caller, but by the framework.
• extensibility: A user can extend the framework – usually by
selective overriding – or programmers can add specialized user code to
provide specific functionality.
• non-modifiable framework code: The
framework code, in general, is not supposed to be modified, while
accepting user-implemented extensions. In other words, users can
extend the framework, but cannot modify its code.

mvvmcross setup class for iOS - mvxiossetup vs mvxtouchsetup

I am going through the example available for mvvmcross and I came across setup base class for the iOS.
-mvxiossetup
-mvxtouchsetup
Can someone explain what are the main differences and when you should use one more than another.
Thanks
Seb
Since MvvmCross 4.0-beta8 the namespaces have been updated and cleaned. Touch was the previous name of iOS before Xamarin unified that to iOS.
So after MvvmCross 4.0-beta8 you always need to use MvxIosSetup.
You can read more about this in the blog post: http://mvvmcross.com/blog/mvvmcross-40-beta8

iOS / XCode separate layers in targets

I am fairly new to iOS and XCode and come from .Net background. So in Visual Studio I would usually separate the layers of my application (say WebApp layer, business logic layer, data access layer etc.) into separate project so I can have control over what each project depends on etc.
So my question is if there is something similar in XCode? I tried using the static library template for a target and it seems to be working but I am wondering if there are any drawbacks for this approach? All the examples I find on the Internet just show a folder structure in the app target for the layers is this the preferred way of doing it and why?
I am also using Swift if that makes any difference but I still do have dependencies on 3rd party libraries developed in Objective-C
New in Xcode 6 / iOS 8, you can make a framework, thus dividing your code into multiple targets. This is a nice easy way to separate reusable functionality. It also has the advantage of privacy; in Swift, each framework is a module, and one module that imports another module can see only those members of the imported module that are declared public.
In general, however, I would suggest that you not worry about this; just keep your classes organized conceptually using the MVC architecture that Cocoa encourages, and physically organize them within your project using "groups" (the fake folders that appear in Xcode's project navigator). The reason is that very little of your code is going to prove to be reusable anyway, so it's really just a matter of making editing / developing / maintaining this project as easy as possible.

How to create and use an iOS Framework for sharing code with Extensions

How does the minimal setup and usage of a custom iOS framework look like? I starting to look into this in order to share code with a Today Extension.
Here's what I did so far
Added a new Target choosing the Cocoa Touch Framework template and called it TesterKit
Inside the framework I created a new class TestClass.swift
Inside TestClass.swift I created a simple class method class fund tester() printing a string for testing
Looking at my app I can see that TesterKit has been added as Embedded Binaries and Linked Frameworks and Libraries, however it is red
In order to use this new Framework in the app, I added import TesterKit to the top of my AppDelegate
Then I tried to call the class method from the Framework using TestClass.tester(). But instead of showing the log message I get a …
"Use of unresolved identifier"
→ What am I doing wrong? Any wrong assumptions here?
Note: I already watched the WWDC sessions 416 "Building Modern Frameworks" and found the Framework Programmign Guide. If there are any example projects showing how to use such new custom iOS Frameworks, ideally using Swift + integrating this with Today Extensions, that might be helpful, too.
It seems like your import is not failing which means the framework is actually set up correctly...try making the function public.
public func tester() { print("tester()" }

Registration with Unity

I'm accustomed to using Autofac and with autofac with one line of code I can register all the interfaces in the assembly so that they resolve to whatever classes implement that interface.
In Unity it's looking like I need to register every interface manually. I'm wondering if there is a simpler way to globally register everything, then for lifecycle differences create individual entries.
thanks
There isn't in Unity 2.
There are however contrib projects that try to add this behavior on top of Unity, such as:
Unity Auto Registration
Unity Contrib project
TecX
UPDATE
Unity 3 seems to be just released that contains support for batch-registration.
Unity 3 now supports auto-registration.

Resources