Source: flickr/ Jeff Attaway
M stands for Model – an implementation of the application’s domain model that includes a data model along with business and validation logic. Examples of model objects include repositories, business objects, data transfer objects (DTOs), Plain Old CLR Objects (POCOs), and generated entity and proxy objects.
In object-oriented and functional programming, an immutable object(unchangeable object) is an object whose state cannot be modified after it is created. This is in contrast to a mutable object (changeable object), which can be modified after it is created.
Imagine the next simple situation, your application downloads a JSON, deserialises it to an object and then presents the downloaded data. You would expect the downloaded data to be one-to-one to the data on the remote server, however the data can be accidentally or intentionally mutated. Continue reading “Immutable Models in MVVM”
We live in a great time where technology evolves fast and we need to keep up with it if we want to stay relevant. Beside this, we also have to be productive, use the latest and greatest tools, implement the best available solutions and deliver on time. Following article mentions a list of most common mistakes we tend to do while using Xamarin.Forms.
Continue reading “Most common mistakes beginners make in Xamarin.Forms”
Yesterday I shared with you a command to recursively delete /bin, /obj and /packages directories. While this command is helpful, it might be a pain to use. Since you have to keep a terminal window opened and in general switch context from your IDE to terminal and etc.
A simple solution would be to execute this command without leaving the IDE at all, however in this case I had to extend the IDE itself. Thats how DeepClean extension was born. I am planning to write a proper post about how to extend visual studio for mac a bit later. So stay tuned.
Currently the extension does 2 simple things:
– Deleting /bin & /obj dirs
– Deleting /packages dir – after this you will have to restore the nuget packages, otherwise the solution wont build
You are welcome to download, test and contribute on github.
Please keep in mind that this extension is making it’s first steps, please make sure you have a back up of your code before using it!
Recently had to update some old Xamarin.Forms project to the latest and greatest XF and very quickly I realised that it is not going to be an easy task, since I had to manually manipulate the csproj files to remove the old nuget dependencies. I found myself going thru multiple projects multiple times in order to delete the “bin”, “obj” & “packages” directories to fix the miscellaneous build errors and I came up with a very simple script to recursively delete delete the “bin”, “obj” & “packages” directories:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backup your code before using this script, I am not responsible for any data loss. Please use it wisely.
To use this script: open a terminal in your solution’s root directory and copy paste the script above. Keep in mind that “bin” & “obj” directories will be regenerated after the next build, however “packages” directory will appear again only after restoring nuget packages for the solution.
Xamarin components are easy to install, all you have to do is to download a zip, extract the content and to reference the dlls in your project. This would work if you download the component manually from components gallery. Same thing can be done using Visual Studio in a more robust way via ‘Components’ under the targeting platform projects. Either way, the component will be downloaded and installed only for a specific project.
Sometimes it might be useful to keep the component in cache, so it will be available globally. This is where the XAM file extension comes into play. Generally speaking, it is just an archive, you can change the file extension to zip and use it in a regular way, or vice versa change zip to xam.
Regardless of your OS you have to download xamarin-component.exe.
On Windows execute the next command:
xamain.component.exe install <component.xam>
On MacOS execute the next command with the same executable:
mono xamain.component.exe install <component.xam>
If the command executed successfully, you should see the installed component:
Please note the “Included in this project” and “Installed on this machine”. Components under the second section will be always there unless you will clean the cache. On MacOS the components will be installed under ‘~/Library/Caches/Xamarin’. Please let me know where the cached components are stored on Windows.