Monthly Archives: December 2017

Store a Class object in Android Preferences or Store Non-Primitive types in Android Shared Preferences

By | December 27, 2017

We all know that Android only allows primitives types like int, float to be stored in preferences. But we can change this with the help of GSON. If you want to know more about GSON, you can refer my post here… Using GSON in Android – Simple Demo Now, In this demo, I will show… Read More »

How to Count characters in a String in Swift 4?

By | December 20, 2017

To retrieve a count of the characters in a string, call the global countElements function and pass in a string as the function’s sole parameter: prints “sampleString has 32 characters” Note : Different Unicode characters and different representations of the same Unicode character can require different amounts of memory to store. Because of this, characters… Read More »

How Type Safety is implemeted in Swift 4?

By | December 15, 2017

Swift 4 is a type-safe language which means if a part of your code expects a String, you can’t pass it an Int by mistake. As Swift 4 is type-safe, it performs type-checks when compiling your code and flags any mismatched types as errors. Playground execution failed: error: :6:6: error: cannot assign to ‘let’ value… Read More »

Simple Alert with two buttons in iOS Swift with callback

By | December 1, 2017

Dear Friends, Today I will show you how to create a simple alert with two buttons and how to write a callback for each button. The code is simple. Its written for Swift 3. Send your comments to coderzheaven@gmail.com