Quantcast
Channel: Yudiz Solutions Ltd.
Viewing all 595 articles
Browse latest View live

Swift – Tips for beginner

$
0
0

Swift is brand new programming language introduced by Apple at World Wide Developer Conference 2013 for iOS and OS X apps development. It build on the best of C and Objective-C without constrain of C compatibility. According to apple swift was in many years of development. It has been revealed that apple began working on swift in mid-2010 with team of coders. To make learning easy apple has released two iBooks named “The Swift Programming Language” and “Using swift with cocoa and Objective-C” to its iTunes store which are available to download for free. Using swift require 6.0 or higher version of Xcode. There is also swift playground feature in Xcode which help a lot to learn swift. It would be great for all developers to start using swift as soon as possible. So here are some tips to using swift for starters.

Factory Methods

All Objective-C lovers know about factory methods. These are the class methods which gives easy instance of class as our requirement.

[NSString stringWithFormat:@"Swift Language”]

In swift there are no factory methods so you think in swift version of NSString you can find this method then you are totally wrong. Swift version of this method is like this

NSString(format: "Swift Language”)

So as we can see swift converts all factory methods to initialising method in this case above method is convenience initialiser.

So if you don’t found any class method which you used to write in Objective-C than don’t panic

just try using init methods you will find one over there.

Optionals

Optionals are one of the biggest feature in swift. Optional is way to defining object that you are using can be nil or it can have a value.Optionals are an example of the fact that Swift is a type safe language. Swift helps you to declare optionals like this

Var myStr :NSString?

So myStr is optional type we can’t use it directly. In order to use it we must unwrap the option type like this

if let mySting = myStr {
// myString is unwrapped and can be used directly.
} else {
// myStr is nil. and performing any operation on that will throw an exception.
}

Closures

Closures are same as blocks in objective-C which are functional pointer in C. lets compare Blocks and Closures with its language perspective.

as Variable

NSString* (^myBlock)(NSSting* str1) = ^NSString* (var_type NSSting* str1)
{
// body
};
var myBlock = { (str1: String) -> String in
// body
}

as Property

@property (copy) NSString* (^myBlock) (NSSting* str1);
var myBlock : ((str1: String) -> String)

as Method

(void)myMethod:(NSString* (^)(NSSting* str1))myBlock;
func myMethod(myBlock: ((str1: String) -> String)) -> ()

as Argument

[obj1 doSomethingWithBlock: ^NSString* (NSString* str1)
{
//body
}];
obj1.doSomething(block: { (str1: String) -> Sting in /* body */ })

as Anonymous

^NSString* (NSString* str1)
{
//body
};
{ (str1: String) -> Sting in /* body */ }

as typedef

typedef NSString* (^myBlockType)(NSString* str1);
typealias myBlockType = ((str1: String) -> String)

as Inline

^NSString* (NSString *str1)
{
// body
}(str1);
{ (str1: String) -> Sting in /* body */ }(myStr1)

as Recursive

__block NSString* (^myBlock)(NSString* str1) = [^NSString* (NSString* str1)
{
if (returnCondition)
{
myBlock = nil;
return;
}
// body
} copy];
myBlock(str1);
var myBlock: ((str1: String) -> String)!
myBlock = { (str1: String) -> String in
if returnCondition {
self.myBlock = nil;
return;
}
// body
}
myBlock(Str1)

as Returning

(NSString* (^) (str1: String)) myMehodName
{
// body
}
func myMethodName () -> ((str1: String) -> String) {
// method body
}

Optional Chaining

Optional chaining in Swift is similar to messaging nil in Objective-C, but in a way that works for any type, and that can be checked for success or failure.

Optional chaining will of course only work with optional types. we can access its property and methods with using “?” in syntax. for example lets say we have String object as of optional type.

var str : String?
var aBool : Bool? = str?.hasPrefix(“my”)

hasPrefix will give true or false if str has a value in it other wise it will give nil. that will make Bool,

which is its return type a option type. although in library hasPrefix gives Bool return type no

Bool?(Optional).

extension String {
/// Return `true` iff `self` begins with `prefix`
func hasPrefix(prefix: String) -> Bool
/// Return `true` iff `self` ends with `suffix`
func hasSuffix(suffix: String) -> Bool
}

But while it is being used in optional chaining, the result will always come as optional.

Type Casting

Type casting is a way to check the type of an instance, and/or to treat that instance as if it is a different superclass or subclass from somewhere else in its own class hierarchy.

Casting can be of two types, upcasting and downcasting. upcasting is implicit. Casting can be done by “as” syntax. So lets say you have a AnyObject and you want to teat it as String then you shall be doing this.

var obj : AnyObject

var aBool = (obj as String).hasPrefix

This type of casting is known as downcasting where we explicitly need to downcast the object. Casting doesn’t not change the object or value it is just for compiler satisfaction if any thing goes wrong it would throw exception runtime.

To make code safe from this exception we can use optional casting(as?) which would work like this

var aBool :Bool? = (obj as? String).hasPrefix

now the hasPrefix will only get called if obj is actually of String type. So return type would be option.


Why medical organization should feel a need for a mobile app?

$
0
0

Mobile world has penetrated into each and every sector of the economy. Among that, healthcare sector is benefited most. Surges in mobility, enhanced data connectivity and big data analytics are mainly accountable for mobility in healthcare.

Mobile applications based on healthcare management helps to track health records. All this records are stored in cloud data system for anytime and anywhere accessibility. Devices like smartwatch and wearable technology helps to keep the health record of the patients which helps the patients to take active part in their own health. Many health app developers provides links to multiple hospitals across the world in their application.

Electronic tattoos, Bluetooth-enabled dental implants, and a myriad of sensors keeps track of patient’s physical fitness and provides them where they can be administered. Patient care is effectively managed through the data obtained from healthcare devices and apps before and during hospitalization.

Patient healthcare management

This methodology saves patients time. It manages everything from patient admission to discharge. Healthcare providers can use these applications to manage appointments, schedule an appointment, manage patient cases, laboratory and pharmacy record corresponding to patient, billing and much more. In this way the practitioner can manage the entire clinic digitally with improved efficiency and profitability. Patient waiting time is reduced with less operational cost.

Patients electronic medical records

There is always an extensive collection of patient’s medical record. Storing of this record in conventional form requires large space and a dedicated team. More importantly this system is time consuming and complicated when it comes to fetch the past record. Healthcare mobile applications ease this management. With electronic health records, doctors can easily access patient information such as medical history, vitals, and lab reports from a secure server.

Automated Inventory Management Systems

Pharmacy stores contains various products which can be classified in varied categories. They also manage purchase order and procurement activities. Most of this products comes with an expiry date. Timely delivery of order is critical for patient care. Mobile solutions implemented in hospitals and pharmaceutical companies manages stocks on real time basis.

Collaborative Medical Tutor

Logs of medical experiments results can be accommodated in a medical app. This result can be reviewed by peers and other students. Quiz feature in mobile helps in increasing medical IQ. This apps are linked with many online medical resources which helps students and trainees across relevant medical literature.

In this way doctors, pharmacist and patients will remain in web of realtime medical data and resources. Fetching of patient medical record will be fast and so the medical treatment. Also there would be no delay in pharmacist procurement services.

Mobile game marketing trends that will be expected in 2016

$
0
0

Mobile users are increasing day by day compared to the desktop one. People send half of their time interacting on mobile apps. The most powerful approach in marketing is to discover and outreach. The customers should be provided branded experience that can actually enhance their lives. We explore here the below trends that will be noticed in the game development industry in 2016.

Augmented Reality

Augmented reality is a technology that superimposes a computer-generated image on a user’s view of the real world, thus providing a composite view. Developing mobile gaming application using AR technology, will enable users to interact with virtual contents in the real world.

Virtual Reality

Virtual Reality is the three dimensional computer generated image or environment. This image or environment can be interacted in a seemingly real or physical way by a person using special electronic equipment. This equipment can be a helmet with a screen inside or gloves fitted with sensors.

Google App Indexing, Deep Linking and Mobile Search Enhancements

Google displays the search content on the basis of the index assigned to that. In the same way game apps search will be displayed on the basis of indexing. Deep links to game app appear in Google Search results, letting users get to your gaming experience quickly, landing exactly on the right content within your app. Deep linking is the use of a hyperlink that links to a specific piece of webpage. That webpage can be child page which is deeply linked with the homepage of the website. eg http://demo/path/page.

Marketing Automation

Marketing automation refers to software platforms and technologies designed for marketing departments and organizations to more effectively market on multiple channels online such as email, social media, websites, etc and automate repetitive tasks.

Social Media Advertising Grows Up

Because social networks gather such a larger amount of user information, social media advertising is able to target your audience in a wider variety of ways than other online platforms. Stretching beyond geographic data, social media advertising has opened the door to deeper interest, behavioral and connection-based targeting methods.

Wearable Marketing and Internet of Things

Gaming apps would be developed for wearable technologies. Wearable technologies incorporate computer and advanced electronic technologies. This devices can be weared on definite parts of the body. They have somewhat similar functionality like smartphones. Wearable devices provide practical functions and features.

The Internet of Things (IoT) is an environment in which objects, animals or people are provided with unique identifiers. They are then able to transfer data over a network without requiring human-to-human or human-to-computer interaction. It has evolved from wireless technologies. IoT will be the biggest trend to look after in 2016.

The most successful game developers will be the one who understand and follow the above gaming trends.

Are you longing for your app to be interactive ?

$
0
0

User experience is something similar to visit to a grocery stores. If the sufficient stock is not available the customer will not be pleased. A pleasant time and hassle free deal is what the user is expecting anywhere. In the same way a app design should be responsive in the way that it is appealing to the users. Content should be well categorized. Here are some things to look for developing a future friendly app:

All devices should be able to provide similar experience

The design of the app should be consistent in all the devices. If the user experiences varied design of the app in different devices then he/she would turn it off immediately. No matter the type of gadget used by the user the viewing experience should remain the same. A seamless experience across devices helps in retaining users and visitors with the brand recall.

Ease of navigation in app

The main intention of pleasant user experience is to direct their user attention to the content. The design should be in the way that it holds the reader. The content of the app should be very well categorized and classified. This classification helps in easy seamless navigation in the website. A user friendly navigation system is designed to attract visitors to their intended space. They should be able to reach there in minimum amount of clicks as possible. Information should be easy to locate in the app.

Highlight important words as a focalpoint

Reader will scan the whole app page and he is not going to read the whole of it. If the visitor is keen on finding the particular content on the app page then it is essential to divert the user to his search. This will help the user to obtain what he/she actually desire for.

The focal point of the app page should be an image. User attention will get directed first towards the image. As a result the user will come to know where the actual content is located.

Better functioning of Links and Buttons

If the user does not get what he wants then he gets frustrated. Visitors expect every link to redirect them to important content pages and not a 404 error. Visual elements need to suggest cohesively about their action and should indicate likewise. For instance, links that look clickable should be clickable, or else the visitor will find it irritating.

Hand over the entire browsing experience to the user

Do not include auto-play videos in your website content. Browsing experience has been snatched away from users with locked scrolling bar. The app should be in total control of the user in terms of browsing and movement throughout the app. The app can be called as in total functioning if it is in total control of the user. There should be right balance of diversity and complexity in the app.

Keeping all this factors in mind will not only help to establish an attractive website but also an interactive one.

How to find dream developer for your restaurant app ?

$
0
0

Do you need to develop a mobile application for your restaurant to remain competitive and to increase your customer’s loyalty. For that you would of course browse the internet and go for online app making. But that’s not the best way for it. Restaurant app development is a complex process and requires team work for it. The app should be developed in a way that it is able to function on different platforms seamlessly. For that you need to hire an app developer company.

Hire experience developer

This is the very first challenging aspect to develop a restaurant app. You should choose the right developer for it. Don’t go for the developer who is advertising multiple apps. You need to ask certain questions before hiring a developer.

Track the company’s record

Portfolio of any organisation is the best ways to understand the importance of the company. The development history of the company is the crucial content to go through. Reviews of the developed app by the company will help to recognise the potential of it. Awards and achievements of the company also say something about them.

Type of investment

Reputable companies will take advance payment and will provide the resultant work according to your budget. While the less reputable companies will promise you for multiple functionality in your app but they won’t be able to provide that. So during the development process you should periodically take follow ups so that you get the value of your money.

Type of support they offer

There is no certainty that the developed app will be error free. You should hire a developer who is able to provide technical support to your customers. You should not hire an Offshore developers for developing an app. As offshore developers are hard to reach in times of difficulties and they are not that much responsive. A reputed organisation would work closely with you and help you in achieving your customers requirement.

Applications features and coding

Make sure that the developed application has full functional features that is adhere to satisfy the requirements of your customers. Application should be robust and able to function on different platforms like iOS and ANDROID. Menu should be placed in right order and there should be easy navigation feature in your app. You app should be able to collaborate with social media like facebook and twitter.

Provider of White Label App

A white label app means that the developer name is not incorporated in the app. Instead the company name of the client is. This will make sure that you are getting an app that is branded by your restaurant.

Yudiz, is a pioneer in developing mobile applications and website development. It strictly follows agile methodology while developing an application. There testing team rigorously test the application of any errors. To know about Yudiz for developing an mobile app restaurant, click here.

Developer to End-user : All that you need to know about Apple TV and tvOS

$
0
0

As a developer of app not everyday, a new platform for development gets dropped on you. But after the announcement of Apple TV and tvOS that thing comes true. The new tvOS SDK can be use to design and develop apps for Apple TV. With Apple TV on tvOS users can play games, use productivity and watch movies and social apps. This feature imbibed in the apple tv brings new opportunities for developers.

Apple tvOS is derived from iOS. It is a distinct OS becomes some framework are only supported on tvOS. The familiarity of iOS development is that it shares multi user experience. It has open up the opportunity of app development that is unseen in many iOS devices. You can use tools like Xcode, Objective C, Swift and Javascript that you are familiar with.

tvOS App user interface is very much important. This will help the user to navigate easily by providing multiple options. In iOS story board can be used as the launch screen instead of static images. If you need to develop an application for apple tv the first required thing is a new apple tv provisioning profile which is used with our existing iOS development and distribution signing identities. The apple tv provisioning profile can be created in the same way we create an iOS provisioning profile using Fix issue in Xcode or through the developer portable website.

The new Apple TV has the following hardware specifications:

The Apple TV Remote comes in two flavors one with Siri built in and the other with onscreen search capabilities. The following are the tvOS framework:

  • 64-bit A8 processor
  • 32 GB or 64 GB of storage
  • 2 GB of RAM
  • 10/100 Mbps Ethernet
  • WiFi 802.11a/b/g/n/ac
  • 1080p resolution
  • HDMI
  • New Siri Remote / Apple TV Remote

TVML JS – This framework defines the javascript API which are used to load the TVML pages that displays the client-server apps.

TVML Kit – It provides a way to incorporate Javascript and TVML elements into your app.

TV services – This framework describes how to add a top shelf extension to your app.

The video playback feature in Apple TV is based on HTTP Live Streaming and FairPlay Streaming. Developing client-server apps is easier with apple tv. The main purpose of this type of apps is to stream media, using web technologies such as HTTP, XMLHTTPRequest, DOM and Javascript. The TVML kit framework provides the bridge between your native code and javascript code in the user interface.

Swift – Tips for Intermediate

$
0
0

Have you read my previous post about beginner tips for Swift developers? Then, let’s get some serious shit out of Swift in this post. I’ll try to cover new features of Swift like keywords, attributes, and operators here.

1. Guard Statement(guard): It is a control statement introduced with v2.0. It takes a boolean value to perform execution ahead. This statement is used for early exit from any function if conditions don’t come up as your expectation. In a certain way it will guard your control flow.


func registerUser(info: [String: String]) {
guard let name = info[“name”],
let email = info[“email”],
let password = info[“password”]
where password.characters.count > 6 else {
// make early exit with proper display message, because user didn’t provide sufficient data for registration.
return
}
// name, email and password would be accessible here knowing they are strings which meets your requirement.
}

2. Defer Statement (defer): How many times in your functions you required to cleanup operations before it returns. Don’t hassle, because swift 2.0 gives you new statement called ‘defer’ which makes sure the number of code you write inside it will be executed only when execution leave the current scope.


func resizeImage(url: NSURL) -> UIImage? {
// ...
let dataSize: Int = ...
let destData = UnsafeMutablePointer.alloc(dataSize)
defer {
destData.dealloc(dataSize)
}
// ...
// All defer block will be called at the end of execution
}

Note that if you have more than one defer blocks in a function. All defer blocks will be called in descending order.


func myfunction() {
// ..
defer {
// block 1
}
// ..
defer {
// block 2
}
defer {
// block 3
}
// ..
// The order of defer block executions will be 3, 2 and 1.
}

As the defer block will be called at the end of current execution; it can handle logical operation.

And, if you’ve an incremental variable which needs to be incremented at the end; you can write it down in defer block.


defer { x += 1 }

3. Autoclosures (@autoclosure): Autoclosures is a syntax closure. You can write it inside your methods to prevent multiple copy of your code. You just write a chunk of code inside two braces, cast it to variable and use it later on where you need that code to be executed multiple times within the method. The code inside of autoclosures do not run until you call the closure.


func myfunction() {
// ..
let hm = {
// body of closure
}
if condition1 {
// ..
if condition2 {
hm()
}
}else {
hm()
}
}

AutoClosures do not take any arguments when it called and it returns the value of the expression wrapped inside it. You can use @autoclosure attribute to mark closure parameter of any function as an autoclosure.


func myfunctionwithclosure(@autoclosure closure: ()->()) {
closure()
}
// calling above function
myfunctionwithclosure(
// body of closure
// note that you don’t need to write curly brace on this closure.
)

4. Nonescaping Closures (@noescape): @noescape is an attribute which tells function that this closure can’t be escaped from here, the scope of the closure is limited within function’s scope.


func myfunctionWithClouser(@noescape closure: ()->()) {
closure()
// This closure can’t escape from here. So you can not assign it to variable
defined out side of this function.
}

It’s good practice to share more information to compiler related to your application logic. Nonescaping closures lets the compiler make more aggressive optimizations because it knows more information about the closure’s lifespan.

Now, when we learned about both Nonescaping closures and Autoclosures. Note that every Autoclosures are Nonescaping. if you want to make any autoclosure escapable, use @autoclosure(escaping) attribute.

5. Nil Coalescing Operator (??): The nil coalescing operator (a ?? b) unwraps an optional ‘a’ if it contains a value, or returns a default value ‘b’ if a is nil.

a != nil ? a! : b
It can be simply used with nil coalescing operator,
a ?? b
where a should be an option value, and b should be of same type as a if a is non-nil, it will be unwrapped.

Example:


let defaultColorName = "red"
var userDefinedColorName: String? // defaults to nil
var colorNameToUse = userDefinedColorName ?? defaultColorName
// userDefinedColorName is nil, so colorNameToUse is set to the default of "red”

6. Preventing Overrides (final): You can prevent a method, property or subscript from being overrides by marking it as final. Final is a modifier. Write it before method, property or subscript.

e.g final var, final func, final class func and final subscript
Any attempt to override a final method, property or subscript in subclass is reported as compile-time error. This can be used in class declaration. You can mark any class as final (final class) and the compiler won’t allow that class to override.

7. Dynamic Type Expression (.dynamicType): A dynamicType expression consist of an expression, immediately followed by .dynamicType. It has the following form.


[expression].dynamicType

The expression can’t be the name of a Type. The entire dynamicType expression evaluates to the value of the runtime type of the expression, as the following example shows:


class SomeBaseClass {
class func printClassName() {
print(“SOmeBaseClass”)
}
}
class SomeSubClass: SomeBaseClass {
override class func printClassName() {
print(“SomeSubClass”)
}
}


let someInstance: SomeBaseClass = SomeSubClass()
// someInstance has a static type of SomeBaseClass at compile time, and It has a dynamic type of SomeSubClass at runtime
someInstance.dynamicType.printClassName

8. Dynamic: This is a declaration modifier. Declaration modifiers are keywords or context – sensitive keywords that modify the behaviour or the meaning of a declaration. Apply ‘dynamic’ modifier to any member of a class that can be represented by Objective-C. When you mark a member declaration with dynamic modifier, access to that member is always dynamically dispatched using the Objective-C runtime. Access to that member is never inlined by the compiler.

Because declaration with the dynamic modifier are dispatched using the Objective-C runtime, they are implicitly marked the objc attributes.

There are some other declaration modifiers too in swift like lazy, optional, required and weak. You can learn it from Apple’s swift document.

9. Type Alias Declaration (typealias): A type alias declaration introduces a named alias of an existing type into your program. It is more like ‘typedef’ of Objective-C and C. Type alias declaration are declared using the ‘typealias’ keyword and have the following form.


typealias [name] = [existing type]
for example:
typealias WSBlock = (json: AnyObject?, flag: Int) -> ()
typealias MyInt = Int

After declaring a type alias, the aliased name cab can be used instead of the existing type everywhere in your program. The existing type can be a named type or a compound type. Type aliases do not create new types, they simply allow a name to refer to an existing type.

10. Access levels (Public, Internal & Private): Swift provides three different access levels for the entities within your code. These access levels are relative to the source file in which an entity is defined, and also relative to the module that source file belongs to.

– ‘Public’ access enables entities to be used within any source file from their defining module, and also in a source file from another module that imports the defining module. You typically use public access when specifying the public interface to a framework.
– ‘Internal’ access enables entities to be used within any source file from their defining module, but not in any source file outside of that module. You typically use internal access when defining an app’s or a framework’s internal structure.
– ‘Private’ access restricts the use of an entity to its own defining source file. Use private access to hide the implementation details of a specific piece of functionality.

Public access is the highest (least restrictive) access level and private access are the lowest (or most restrictive) access level.

jigar

Jigar Patel | iOS Developer

Jigar Patel is an iOS developer with 4 years of dedicated experience. He is an iOS tech enthusiast. He had developed more than 52 apps successfully. As of his part time activity, he is working on how to minimize app design to make it engaging for the end users.

Create your First VR Game using Unity, Check Our Simple Demo Code !

$
0
0

Introduction

Currently, the most popular option for developing VR games is Unity. Google CardBoard comes as the prime choice to get started rather than spending plenty. Loads of people having smartphones can enjoy your game on a lesser expense.

The core purpose of this tutorial is to describe how to integrate Cardboard SDK with Unity.

Setup for Cardboard SDK

With this SDK and Unity, you can create virtual reality applications in Android as well as iOSthat runs in Google cardboard.

  • Here is the link for CardboardSDKForUnity: Link
  • Here is the link for CardboardDemoForUnity: Link

How to import and preview the demo scene SDKs Package?

Follow 3 simple steps below to import and preview the demo scene SDKs Package :

  1. Open Unity
  2. For SDK package, go to Assets -> Import Package -> Custom Package.
  3. For Demo Package which is a default demo game, go to Assets -> Import Package -> Custom Package.

How to build a demo ?

Follow the below steps to build a demo :

  1. Go to File, select Build Settings and then select Android as your platform.
  2. Click Player Settings. Under “Other Settings”, enter a package name into the “Bundle Identifier” field (for example, com.example.CardboardUnityDemo). Under “Resolution and Presentation”, check if the default orientation is set to “Landscape Left”.
  3. Click on Build and Run.

Create a game Scary Hospital

Please follow the below instruction and build your own game !

1. SetupCamera

  • Select prefab CameraMain from Cardboard from Assets.Then simply drag and drop into inspector.Later on, you can adjust camera position according to your viewpoint.
  • Now run the project to see how your model looks in game Mode.

It will look similar to the picture shown below:

vr-thumb-1

In playMode, you can move camera using Alt and moving mouse. It will help you see like how things look in vr.

2. Interact with UI

  • One thing we have to consider is UI must be replicated in each eye. So we have to place in virtual space to focus.
  • Create canvas and set it to worldspace.
  • To accomplish this, add the GazeInputMobile script to scene Eventsystem.

3. Creating Reticle

We need a particular pointer to aim something like clicking buttons, hovering.

vr-thumb-2

You can create this by Select a prefab from Cardboard, go to UI and select CardBoardReticle Script into CardBoardMain game object in inspector. Make sure its parent is MainCamera.

vr-thumb-3

This prefab has attached Script named CardboardReticle which has 2 properties as:

  • Reticle Segments: Number of segments making reticle circle.
  • Reticle GrowthSpeed: Growth speed multiplier for the reticle when we aim into UI.

vr-thumb-4

Now, you can hover on UI and can click buttons.

You can make many stuff with the help of this. Currently in my demo , if I hover on Alien for 3 seconds, it will die!

vr-thumb-5

Check Our Demo Here: Download Dropbox Link

Now you can develop your own game referring the demo dropbox link given above and feel free to use it. This article would be a perfect pick to developing VR games describing an easy and trouble free way working with Google CardBoard and Unity. As always, please comment below.


Thanks to all our clients and Yudiz team for making this Dubai Trip a huge success!!

$
0
0

Yudiz has been working in the field of Mobile Gaming, Mobile Applications and Web Development since 6 years and we have had the priviledge to work on more than 800+ projects successfully.

But besides that, to succeed more in business and reach new levels, you always need to explore new concepts and meet more intellectual people for exchanging amazing ideas.

Last week our Director Mr. Pratik Patel and Our Business Development Head Mr. Kalyan Acharya had a Business Trip to Dubai(UAE). Mr. Pratik Patel takes care of business development, client relationship, strategies. He is logically strong and leading and initiating in nature.

Mr Kalyan Acharya is a dynamic marketing professional with an extraordinary track record in developing and executing strategies that have proved to be very effective.The main agenda of this business trip was to have meetings with new as well as existing clients and exchange ideas about the latest trends and IT solutions.

dubai-meet-2
dubai-meet-3

We are glad that we had many productive meetings with our clients. With business trips like these, we tend to learn more by meeting people from different geographical areas who have different cultures and different mindsets for running their business. Importantly, it also gives us an opportunity to let our clients understand us better; thereby building mutual trust.

Dubai was one of its kind and so were the people that we came across.

The meetings were informative where we shared our company details,its success stories, discussed new technologies that we have been working on and built new business relationships. We also understood clients’ business and the challenges that they face in their current business models, which helped us to provide them our views in solving their challenges. We were also impressed to see and learn their way of working and many of their business strategies were inspirational for us.

Almost all of the meetings that we did went successful and really productive.We are looking forward to long term relationships with all the clients that we had met in person.Once again a huge thanks to the clients for taking out their precious time for us and team

Yudiz for supporting us and making this trip successful!!!

Making a basic 2D tile map editor using a custom inspector

$
0
0

Overview

Custom inspectors help you to change the way the inspectors look and work. They also allow you to add a lot of flexibility and certain behaviours to your regular inspectors.

We’ll create a custom inspector and make a very basic 2D tile map editor using the same. Map editors or levels editors are tools that are used to quickly create map layouts for level design. They can be used for prototyping a level too. Although, there is a plethora of map editors already available on the asset store and Unity is already working on their own version, creating one yourself will help you learn the basics of Editor scripting in Unity.

Scripting

We’ll start in a new, empty scene. Create a new game object and call it “Map Editor”. Create a new C# script, name it “Map”, and attach it to the newly created game object. Remove the Start() and Update() methods. We won’t be needing them.

The Map.cs script should look like this:


using UnityEngine;
using System.Collections;
public class Map : MonoBehaviour
{
}

Create a new Folder named “Editor” in the Assets folder. Scripts put inside this folder will be treated as editor scripts which help add functionality to the Unity editor and hence these scripts are not included in the final, finished game.

Inside the editor folder, create another C# script and call it “MapEditor”. Remove the Start() and Update() methods from this one as well. Also, since this is an editor script, it needs to extend from the “Editor” class instead of the “MonoBehaviour” class. You’ll need to add the UnityEditor namespace at the top.

We also want this script to know what class the Editor is being used for. It can be done by adding the “CustomEditor” attribute to the class with the name of the MonoBehaviour class as the type.

The MapEditor.cs script should looks like this:


using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(Map))]
public class MapEditor : Editor
{
}

Next, we’ll need to declare an array for prefabs that are to be loaded and used as tiles. There’ll also be a seletedPrefab game object to store the selected prefab reference and then there’ll a game object list to store all the instantiated game objects.


GameObject[] prefabs;
GameObject selectedPrefab;
List spawnedGO = new List();

To be able to add our own components to the Custom Inspector, we’ll need to override the OnInspectorGUI() method. We call the DrawDefaultInspector() method inside it.


using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Collections.Generic;
[CustomEditor(typeof(Map))]
public class MapEditor : Editor
{
GameObject[] prefabs;
GameObject selectedPrefab;
List spawnedGO = new List();
public override void OnInspectorGUI()
{
DrawDefaultInspector ();
}
}

Now, we’ll need a few prefabs which are to be loaded and shows in the inspector. First, we create a new folder called “Resources” in the “Assets” folder. Inside it, create a “Prefabs” folder. This is where we’ll put our prefabs.

Get a few sprites that you’d like to use in your game. I used a few from this awesome and free platformer art pack by Kenney.

Drag and drop a few sprites in the scene and add BoxCollider2D component to them. We’ll need the colliders later to detect raycasts. Create prefabs for each of those. Place those prefabs in the “Prefabs” folder we created a bit earlier. Remove the game objects from the scene.

2Deditor1

Next, we need to load all the prefabs available in the “Prefabs” folder.


//Load all prefabs as objects from the 'Prefabs' folder
Object[] obj = Resources.LoadAll ("Prefabs",typeof(GameObject));
//initialize the game object array
prefabs = new GameObject[obj.Length];
//store the game objects in the array
for(int i=0; i < obj.Length; i++) { prefabs[i]=(GameObject)obj[i]; }

To display the loaded prefabs as buttons in the inspector, we create one button for each loaded prefab. We also get the image used in the prefabs and put it over our button so we know which buttons selects which prefab. The GUILayout.BeginHorizontal () method begins a horizontal control group. All the content inside this will be placed horizontally next to each other. Add the following code inside the OnInspectorGUI() method.


GUILayout.BeginHorizontal ();
if(prefabs!=null)
{
for( int i=0; i ().sprite.texture;
//create one button for each prefab
//if a button is clicked, select that prefab and focus on the scene view
if(GUILayout.Button(prefabTexture,GUILayout.MaxWidth(50), GUILayout.MaxHeight(50)))
{
selectedPrefab = prefabs[i];
EditorWindow.FocusWindowIfItsOpen();
}
}
}
GUILayout.EndHorizontal();

If a button is clicked, the selectedPrefab variable will be supplied with the relevant prefab selected and the focus will move to the Scene View, where we can place/spawn/instantiate our selected prefab.

The inspector should look like this:

2Deditor2

See the problem? The buttons are placed horizontally but they continue beyond the width of the inspector. A quick and dirty fix will be counting the number of buttons in a row, and if if goes past a certain number of buttons, end the current horizontal group and start a new one. If you want it to be dynamic, you can check the width of the inspector using Screen.width and set the number of buttons accordingly, like so:


GUILayout.BeginHorizontal ();
if(prefabs!=null)
{
int elementsInThisRow=0;
for( int i=0; i ().sprite.texture;
//create one button for earch prefabs
//if a button is clicked, select that prefab and focus on the scene view
if(GUILayout.Button(prefabTexture,GUILayout.MaxWidth(50), GUILayout.MaxHeight(50)))
{
selectedPrefab = prefabs[i];
EditorWindow.FocusWindowIfItsOpen();
}
//move to next row after creating a certain number of buttons so it doesn't overflow horizontally
if(elementsInThisRow>Screen.width/70)
{
elementsInThisRow=0;
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal ();
}
}
}
GUILayout.EndHorizontal();

Now, we need to move to the Scene View. Create an OnSceneGUI() method. It handles all the events in the scene view.

In this method, we check if the Key “E” is pressed and instantiate the selected prefab as a game object at the position of the mouse pointer inside the scene view.


void OnSceneGUI()
{
Vector3 spawnPosition = HandleUtility.GUIPointToWorldRay (Event.current.mousePosition).origin;
//if 'E' pressed, spawn the selected prefab
if (Event.current.type==EventType.KeyDown &&Event.current.keyCode == KeyCode.E)
{
Spawn(spawnPosition);
}
}

The Spawn() method simply takes the mouse position and instantiates the prefab at that position. It also renames the instantiated game object and adds it to the spawnedGO list we created at the beginning and sets the newly created game object as the selectedGameObject. We’ll use this later in the script. Following is the code for the Spawn() method.


GameObject selectedGameObject;
void Spawn(Vector2 _spawnPosition)
{
GameObject go = (GameObject)Instantiate(selectedPrefab,new Vector3(_spawnPosition.x, _spawnPosition.y, 0),
selectedPrefab.transform.rotation);
selectedGameObject = go;
go.name = selectedPrefab.name;
spawnedGO.Add(go);
}

At this point, you have your basic tile editor ready to use. Just select the Map Editor game object in the hierarchy, click on a button to select a prefab to spawn, go to the scene view and press ‘E’ anywhere you want to spawn the selected prefab. It’s usable, but we can make it better by adding a few nifty features.

2Deditor3

To add an undo feature, we check if the “X” key is pressed. Then, we destroy the last element in the spawnedGO list and remove it from the list too:


//if 'X' is pressed, undo (remove the last spawned prefab)
if (Event.current.type==EventType.KeyDown &&Event.current.keyCode == KeyCode.X)
{
if(spawnedGO.Count>0)
{
DestroyImmediate(spawnedGO[spawnedGO.Count-1]);
spawnedGO.RemoveAt(spawnedGO.Count-1);
}
}

We can add a bit of GUI in the scene view itself to indicate if the tile edit mode is active and if a prefab has been selected to spawn.


Handles.BeginGUI();
GUILayout.Box("Map Edit Mode");
if(selectedPrefab==null)
{
GUILayout.Box("No prefab selected!");
}
Handles.EndGUI();

My favorite feature is the snapped spawning, where the game objects are spawned next to each other so you don’t need to adjust their positions every time you spawn one.

The following code checks for a directional key press (W,S,A,D; not the arrow keys. You can use them too though) and spawns the selected game object next to the last spawned game object. The code checks for the width and height of both the spawned and to be spawned game objects so they are placed right next to each other even if they are of different widths and heights. Note that selectedPrefab is the prefab selected using the buttons in the inspector while the selectedGameObject is the last spawned game object in the scene.


if(selectedPrefab!=null)
{
if(selectedGameObject!=null)
{
float selectedGameObjectWidth = selectedGameObject.GetComponent().bounds.size.x;
float selectedGameObjectHeight = selectedGameObject.GetComponent().bounds.size.y;
float selectedPrefabWidth = selectedPrefab.GetComponent().bounds.size.x;
float selectedPrefabHeight = selectedPrefab.GetComponent().bounds.size.y;
if (Event.current.type==EventType.KeyDown &&Event.current.keyCode == KeyCode.W)
{
spawnPosition = new Vector3(selectedGameObject.transform.position.x, selectedGameObject.transform.position.y+
(selectedGameObjectHeight/2)+(selectedPrefabHeight/2), 0);
Spawn(spawnPosition);
}
if (Event.current.type==EventType.KeyDown &&Event.current.keyCode == KeyCode.S)
{
spawnPosition = new Vector3(selectedGameObject.transform.position.x, selectedGameObject.transform.position.y-
(selectedGameObjectHeight/2)-(selectedPrefabHeight/2), 0);
Spawn(spawnPosition);
}
if (Event.current.type==EventType.KeyDown &&Event.current.keyCode == KeyCode.A)
{
spawnPosition = new Vector3(selectedGameObject.transform.position.x-(selectedGameObjectWidth/2)-
(selectedPrefabWidth/2), selectedGameObject.transform.position.y, 0);
Spawn(spawnPosition);
}
if (Event.current.type==EventType.KeyDown &&Event.current.keyCode == KeyCode.D)
{
spawnPosition = new Vector3(selectedGameObject.transform.position.x+(selectedGameObjectWidth/2)+
(selectedPrefabWidth/2), selectedGameObject.transform.position.y, 0);
Spawn(spawnPosition);
}
}
}

But what if we want to spawn a prefab next to a different game object as opposed to the last spawned one? To achieve this, we can shoot a ray below the mouse pointer in the scene view every time we press the key, say, “R”, and check for a game object at that point. If a game object is found, we set it as the selected game object, so the next time we try snapped spawning, the game object is spawned to the newly selected one. Note that the raycast won’t work if your game object doesn’t have a collider.


if (Event.current.type==EventType.KeyDown &&Event.current.keyCode == KeyCode.R)
{
Vector2 mouseWorldPosition = new Vector2(spawnPosition.x, spawnPosition.y);
RaycastHit2D hitInfo = Physics2D.Raycast(mouseWorldPosition, Vector2.zero);
if(hitInfo.collider != null)
{
selectedGameObject = hitInfo.collider.gameObject;
}
}

To indicate which game object is currently selected, we add a handle at its position using the following code. This will show an “X” mark over the currently selected game object in the Scene View.


if(selectedGameObject!=null)
{
Handles.Label(selectedGameObject.transform.position, "X");
}

You can also add a small circle handle below the mouse pointer to see what the current spawn position is. At the end of the OnSceneGUI() method, call the SceneView.RepaintAll() method to update the scene view.


//used to indicate the exact point where the prefab will be instantiated
Handles.CircleCap (0, spawnPosition, Quaternion.Euler(0,0,0), .05f);
//…
//...
SceneView.RepaintAll();

That should do it. Here’s a glorious .gif.

2Deditor4

harshit

Harshit Dubey | Unity Game Developer

I am Unity game developer and a casual gamer. I am fond of story-driven games and creating one based on strong and compelling narrative structure is my dream.

Adding GUI elements to the Hierarchy Window

$
0
0

Overview

Click To Download Full Source Code

This post shows how to add GUI elements to the game objects in the Hierarchy Window in Unity. You can add elements like toggles, buttons, and icons/images to the game objects in the hierarchy.

Example:

GUIelements1

Now, I’m not a fan of the whole ‘process’ where I have to select a gameobject, move my mouse pointer all the way to the inspector and click on the check box at the top to deactivate it. So, let’s create a toggle in the hierarchy itself that’ll help us quickly activate and deactivate a game object.

Create a new script and name it HierarchyGUI.cs. This script won’t be attached to any of the game objects in our scene, so it doesn’t need to inherit from MonoBehaviour. Also, get rid of the Start() and Update() methods and add the UnityEditor namespace.

We want the script to ‘launch’ as soon as Unity starts without requiring any action from the user. To achieve that, we use the InitializeOnLoad attribute just above the class declaration and by creating a static constructor of the class like so:

using UnityEngine;
using System.Collections;
using UnityEditor;
[InitializeOnLoad]
public class HierarchyGUI : MonoBehaviour 
{
    //constructor
    static HierarchyGUI ()
    {
    }
}

Inside the constructor, subscribe to EditorApplication.hierarchyWindowItemOnGUI. It’s a Delegate to be called for every visible list item in the Hierarchy Window on every OnGUI event.

Next, create the method that is subscribed to the Delegate. Two parameters come with the Delegate: the instance ID of the object and its rect.

Your script should now look something like this:

using UnityEngine;
using System.Collections;
using UnityEditor;
[InitializeOnLoad]
public class HierarchyGUI : MonoBehaviour 
{
    //constructor
    static HierarchyGUI ()
    {
        EditorApplication.hierarchyWindowItemOnGUI += OnHierarchyGUI;
    }
    static void OnHierarchyGUI(int instanceID, Rect selectionRect)
    {
    }
}

Inside the OnHierarchyGUI() method, we use the instance IDs to get the game object references.

//get the gameObject reference using its instance ID
GameObject go = (GameObject)EditorUtility.InstanceIDToObject(instanceID);

Get the rect of the selection and set its x position equal to the width. This will place the toggle on the right of the selection and prevent it from overlapping with the name of the game object.

//get rect m8
Rect rect = new Rect (selectionRect);
rect.x = rect.width;

Finally, create the toggle using GUI.Toggle and position it using the rect.

//toggle
bool toggleStatus = GUI.Toggle(rect, go.activeInHierarchy, "");
go.SetActive(toggleStatus);

Save and go check your Hierarchy Window. There should be a toggle next to every game object in your Hierarchy Window which will activate/deactivate the game object.

GUIelements2

You can also add text labels just to highlight specific game objects. But, instead of adding one to every game object in the scene, let’s create a game object called Game Manager and add the label only to it.

The code will sift through all the objects in the Hierarchy Window, identify the Game Manager and add the label only to it. We’ll use the MenuItem attribute to call a method from the hierarchy context menu.

The MenuItem attribute is used to add a context menu. We add it to the GameObject menu inside the Marker submenu and call it GameManager. It shows up when you right click on a game object in the Hierarchy Window. Go to Marker>GameManager to ‘mark’ the game object. We use the instance ID of the game object to ‘remember’ its ID and use EditorPrefs to save the string. EditorPrefs are like PlayerPrefs but for the Editor. We also put in an else in case you want to remove the game object as the Game Manager.

Since we’ll be using the Instance ID for more than 1 marker, we add a suffix to it for each one of our markers. I used ‘G’ for Game Manager, ‘UI’ for UI, and ‘toggle’ for the Toggles.

[MenuItem("GameObject/Marker/GameManager", false, 1)]
    static void AddGameManagerMarker()
    {
        foreach(Object o in Selection.gameObjects)
        {
            if(EditorPrefs.GetInt(o.GetInstanceID()+"G")==0)
            {
                EditorPrefs.SetInt(o.GetInstanceID()+"G", 1);
            }
            else
            {
                EditorPrefs.SetInt(o.GetInstanceID()+"G", 0);
            }
        }
    }

GUIelements3

The code only sets the EditorPrefs for the selected game object. It doesn’t add the text label yet. To add one, we need to go back to the OnHierarchyGUI() method.

We check if a game object is ‘marked’ as the Game Manager. If it is, we add a text ‘G’ to it using GUI.Label. We also move the rect a bit to the left so it doesn’t overlap with the Toggle we added earlier.

//GM marker
if(EditorPrefs.GetInt(go.GetInstanceID()+"G")==1)
{
    rect.x = rect.width-15;
    GUI.Label(rect, "G");
}

GUIelements4

Note that calling the method again removes the marker.

Instead of adding toggles to every game object, we can use the same logic to add the toggle to specific game objects.

We can also add tiny images as icons instead of just plain, boring text labels. First, we declare a Texture2D and a GUIStyle.

static Texture2D UITexture;
static GUIStyle style;

Create a ‘Resources’ folder in the Assets folder and put an image inside it.

GUIelements5

Load it using Resources.Load(name_of_the_image) inside the constructor like so:

UITexture = (Texture2D)Resources.Load("UI Texture");
//new guistyle for the markers
style = new GUIStyle();

I used the image to mark UI game objects in the scene. You’ll need to set the height and width of the rect so the icon appears in the correct position.

//UI marker
    if(EditorPrefs.GetInt(go.GetInstanceID()+"UI")==1)
    {
        rect.x = rect.width-15;
        rect.width=15;
        rect.height=rect.height-2;
        //use the texture as the background for the style
        style.normal.background = UITexture;
        //use the style in the GUI label.
        GUI.Label(rect,"", style);
    }

That’s all. You can also create a method to remove all the markers so you don’t need to select each one of them individually.

//Remove all markers
    [MenuItem("GameObject/Marker/Remove", false,13)]
    static void RemoveMarkers()
    {
        foreach(Object o in Selection.gameObjects)
        {
            EditorPrefs.SetInt(o.GetInstanceID()+"toggle", 0);
            EditorPrefs.SetInt(o.GetInstanceID()+"G", 0);
            EditorPrefs.SetInt(o.GetInstanceID()+"UI", 0);
        }
    }

GUIelements6

Click To Download Full Source Code

harshit

Harshit Dubey | Unity Game Developer

I am Unity game developer and a casual gamer. I am fond of story-driven games and creating one based on strong and compelling narrative structure is my dream.

Implement Siri feature in your application to Send Message without opening your application.

$
0
0

Click To Download Full Source Code

  • iOS: 10
  • Language: Swift
  • Xcode Version: 8
  • Mac OS: 10.12

Step 1: Create Simple Xcode Project

For this demo, first create a Xcode project by selecting ‘Single View Application’ type.

Step 2: Add Siri Extension

  • Now we need to add ‘Intents Extension’ in application. For that open this screen firstsiri_screen_1
  • Select ‘Intents Extension’ in your application and click on ‘Next’ button siri_screen_2
  • Enter name of the extension. Here I have entered ‘MessageIntent’. And then click on ‘Finish’ button.siri_screen_3
  • Once you click on ‘Finish’ button, user can see the below screen siri_screen_4.
  • In this screen Xcode is asking you to active scheme for this new extension. So you can use this scheme for building and debugging. Schemes can be chosen in the toolbar or Product menu. Please active scheme for ‘MessageIntent’.
  • Once you activate scheme for ‘MessageIntent’ scheme then Xcode will display the below screen.siri_screen_5
  • In this screen Xcode is asking you to activate scheme for ‘MessageIntentUI’ extension. So please activate scheme for this extension too.
  • By using ’MessageIntentUI’ extension you can display UI while doing operation with Siri. We will come to this later.
  • Now you are done with adding Siri extension.

Step 3: Understanding what files you are getting after adding Siri extension

In below screen shot siri_screen, you can see that there are two different extensions that were added.

  • MessageIntent: This extension handles all operations for Siri feature
  • MessageIntentUI: This extension is user interface for handling Siri operation.

MessageIntent:
In this extension, you will find that there are total two files:

  1. info.plist
  2. IntentHandler.swift

Info.plist:

  • In plist file you have to mention what type of operation you want to perform by using siri. siri_screen
  • Right now let us consider three extensions for this demo,
    INSendMessageIntent – To send message
    INSearchForMessagesIntent – Search new incoming message
    INSetMessageAttributeIntent – To set message content attribute
  • If your application has some different requirement like: search hotel, search taxi etc.,then you can select any intent to provide support. siri_screen

IntentHandler.swift:

  • In swift file you have to implement all operations which you like to handle as per supported intent type for Siri.
  • You can check all necessary and optional method from Siri intent class. Here in below screen shots you can find structure and methods for ‘INSendMessageIntent’.
    siri_screen
    siri_screen
    siri_screen

Step 4: Run on your iOS Device

  • Now connect your device with your system.
  • Select ’SiriDemo’ from the scheme and run. Once it runs on your device then stop it. siri_screen
  • Now select ‘MessageIntent’ from the scheme and run. siri_screen
  • Now select your application from this window to continue. In this case, application name is ’SiriDemo’ so select it to continue. siri_screen
  • Now stop operation again from Xcode.
  • Now enable Siri supports for your app manually [Settings -> Siri -> App Supports]
    siri_screen
    siri_screen
  • Now you are ready for Siri operation.

Step 5: How to test

  • Try the Siri command. Activate Siri either by long pressing the Home button, or by saying “Hey Siri!” (note: the “Hey Siri!” feature must be enabled in the settings first)
  • Try out some of the command “Send message using SiriDemo”.
    siri_screen
    siri_screen
  • Now Siri will display UI by using ‘MessageIntentUI’ extension. siri_screen
  • Now just speak contact name of the person to whom you want to send message and the message content.
    siri_screen
  • Once you speak the message, then Siri will ask you if it should proceed to send message. If you say ‘Yes’ then Siri will send message and if you say ‘No’ then Siri will not send message until you ask Siri to do it.
    siri_screen
    siri_screen
    siri_screen
  • So in this way Siri will handle your command to send a message to particular contact.

Step 6: How to handle Siri command inside Application

First of all you have to implement all necessary methods under ‘IntentHandler.swift’ class which are related all intent which you select.
Method 1: resolveRecipients
siri_screen

  • This is an optional method
  • In this method you will receive contact detail which user speaks.
  • So first you have to check if this contact is there in your application records.
  • If no records are found by the application then you have to call below block

var resolutionResults = [INPersonResolutionResult]()
resolutionResults += [INPersonResolutionResult.unsupported()]
completion(resolutionResults)

  • If records are found by application, then you have to check if the matching contact count is equal to 1. Then you need to call below block.

var resolutionResults = [INPersonResolutionResult]()
resolutionResults += [INPersonResolutionResult.success(with: recipient)]
completion(resolutionResults)

  • If more than one match found, then you need to ask the user which option he/she needs to select. For that you need to call below block

var resolutionResults = [INPersonResolutionResult]()
resolutionResults += [INPersonResolutionResult.disambiguation(with: matchingContacts)]
completion(resolutionResults)

  • If user has not provided any recipients then you have to call below block to ask user to speak contact name again.

completion([INPersonResolutionResult.needsValue()])

Method 2: resolveContent
siri_screen

  • This is an optional method
  • In this method you will receive text content for the message.
  • If this method receives empty text content then you have to call below block to ask user to speak content again
    completion(INStringResolutionResult.needsValue())
  • If this method receives proper text then you have to call below block to proceed to send text message.
    completion(INStringResolutionResult.success(with: text))

Method 3: confirm
siri_screen

  • This is an optional method
  • In this method you have verify all necessary condition to send message.
  • In this method you will have all details including message content and recipient.
  • If all validations are proper to proceed to send message then you need to call below block,
    completion(INStringResolutionResult.success(with: text))
  • If validations are not proper then you need to call below block to terminate process,
    completion(INStringResolutionResult.needsValue())

Method 4: handle
siri_screen

  • This method is mandatory.
  • In this method you have to implement your logic to call API to send message to particular user.
  • And based on API call response you have to call block to indicate user on Siri screen for message status.
  • If message successfully sent, then you have to call below block,
    let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))
    let response = INSendMessageIntentResponse(code: .success, userActivity: userActivity)
    completion(response)
  • If message is not getting sent, then you have to call below block,
    let userActivity = NSUserActivity(activityType: NSStringFromClass(INSendMessageIntent.self))
    let response = INSendMessageIntentResponse(code: .failure, userActivity: userActivity)
    completion(response)
  • You can set any type to handle failure state. You can find all types of failure stats in below screen shot. Please use any as per your requirement [Screen_16]

Click To Download Full Source Code

Ravi Bokade

Ravi Bokade | Sr. iOS Developer

I am a Sr. iOS developer at Yudiz Solutions Pvt. Ltd. - one of the leading Mobile App development companies. I am passionate both about making apps and writing on a diverse range of development topics.

Getting started with Asset Bundles in Unity

$
0
0

Click To Download Full Source Code

Asset Bundles are files that contain assets. Various assets like models, textures, audio files, etc. can be put in a bundle and exported to be used later. They let you stream assets using the WWW class so you can download the assets from a server at runtime too. Asset Bundles can be used to setup DLCs for games or just to reduce the initial download size.

The Asset Bundle workflow is as follows:

  1. Create Asset Bundle in Unity Editor.
  2. Upload it on a server.
  3. Download and use it during runtime.

Creating Asset Bundles:

asset_bundle

Here we have got 3 watercraft models, namely, ‘Houseboat’, ‘Ship’, and ‘Speedboat’, in the scene. You can use some primitives like Cube, Sphere, Capsule, Cylinder, etc. for this example. Drag and drop the models in the scene and then into the Prefabs folder inside the Assets folder to create the prefabs for them. These prefabs will be exported in the bundle. The names of the prefabs are important because that’s what will be used to load them when required.

asset_bundle

Now, create and put the following script in the Editor folder in Unity.

using UnityEngine;
using System.Collections;
using UnityEditor;

public class CreateAssetBundles : Editor 
{
    [MenuItem("Assets/Create Asset Bundle")]
    static void ExportBundle()
    {
        string bundlePath = "Assets/AssetBundle/watercraft.unity3d";
        Object[] selectedAssets = Selection.GetFiltered(typeof(Object), SelectionMode.Assets);
        BuildPipeline.BuildAssetBundle(Selection.activeObject, selectedAssets, bundlePath,BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets,BuildTarget.StandaloneOSXUniversal);

    }

    }
}

The ExportBundle() method gets all the selected assets in the project window and creates an asset bundle containing the selected assets at the path bundlePath. You can change the BuildTarget depending on your platform.

asset_bundle

Select all the prefabs and click on Create Asset Bundle in the context menu. This will create the asset bundle in the AssetBundle folder. This might take some time depending on the number and size of the assets.

asset_bundle

Uploading Asset Bundles:

Open your Explorer/Finder, navigate to the folder containing the Asset Bundle you just created and upload the .unity file on a server. I used Dropbox for the sake of simplicity.

asset_bundle

Once you’re done, get the link to the file. Make sure the link gets the file downloaded and doesn’t just launch the webpage for the file.

For example, Dropbox gives you a url that will look something like this: https://www.dropbox.com/s/xxxxxxxxxxxxxxx/watercraft.unity3d?dl=0. But using this url will result in an error. Replace ‘dl=0’ with ‘dl=1’ in the link to get the actual download link. That should work.

Downloading Asset Bundles:

Below is a slightly modified version of the actual Asset Downloader script,

Click To Downloading Asset Bundles

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class AssetDownloader : MonoBehaviour 
{
    public string url;
    GameObject waterCraftGO;
    public Text loadingText;
    public Transform spawnPos;

    IEnumerator LoadBundle(string watercraftName) 
    {
        while (!Caching.ready)
        {
            yield return null;
        }

        //Begin download
        WWW www = WWW.LoadFromCacheOrDownload (url, 0);
        yield return www;

        //Load the downloaded bundle
        AssetBundle bundle = www.assetBundle;

        //Load an asset from the loaded bundle
        AssetBundleRequest bundleRequest = bundle.LoadAssetAsync (watercraftName, typeof(GameObject));
        yield return bundleRequest;

        //get object
        GameObject obj = bundleRequest.asset as GameObject;

        waterCraftGO = Instantiate(obj, spawnPos.position, Quaternion.identity) as GameObject;
        loadingText.text = "";

        bundle.Unload(false);
        www.Dispose();
    }

    public void Load(string watercraftName)
    {
        if(waterCraftGO)
        {
            Destroy(waterCraftGO);
        }

        loadingText.text = "Loading...";
        StartCoroutine(LoadBundle(watercraftName));        
    }
}

The LoadBundle() Coroutine downloads the bundle if it isn’t already downloaded or if it doesn’t already exist in the cache by using the LoadFromCacheOrDownload() method. The first parameter is the url to your bundle file on the server and the second one is the version.

Next, we load a specific asset from the bundle using this statement:

AssetBundleRequest request = bundle.LoadAssetAsync (watercraftName, typeof(GameObject));

After loading, we Instantiate the object as a game object in the scene.

Add the AssetDownloader.cs script to an empty game object in your scene and set it up as follows:

asset_bundle

I added a Transform field and a UI Text field to have a spawn position and a loading text available.

Create 3 UI buttons in the Canvas and use them to call the AssetDownloader.Load(string watercraftName) method. Make sure you pass the correct string parameter (the exact names of the prefabs that are in the bundle)

asset_bundle

Play the scene. Clicking on any on the buttons should download the respective asset and instantiate it in the scene. I added a little rotation script later to make it look good.

Initially, the download will take a few seconds. Once you download the bundle, it’s stored in the cache so you don’t need to download it over and over again. Hence, when you try to load an already downloaded asset, it will load the asset from the downloaded bundle in the cache.

Here’s a .gif.

asset_bundle

Click To Download Full Source Code

Harshit

Harshit Dubey | Unity Game Developer

I am Unity game developer and a casual gamer. I am fond of story-driven games and creating one based on strong and compelling narrative structure is my dream.

What’s new in iOS 10 Push Notifications?

$
0
0

Click To Download Full Source Code

  • iOS: 10
  • Language: Swift
  • Xcode Version: 8
  • Mac OS: 10.12

Step 1: Create Simple Xcode Project

For this demo, first create a Xcode project by selecting ‘Single View Application’ type.

Step 2: Enable Remote Notifications

  • Now open your application target. Choose capabilities and ensure that ‘Push Notifications’ is enabled. For that open this screen first.
    notifications
  • Now we need to select ‘Remote notifications’ under background modes. For that open this screen first.
    notifications

Step 3: Registering your applications for remote notifications

  • Now open AppDelegate.swift. For that open this screen first
    notifications
  • Import ‘UserNotifications’ and write below code in ‘didFinishLaunchingWithOptions’ method
    let center = UNUserNotificationCenter.current()
            center.requestAuthorization(options: [.alert, .sound]) { (granted, error) in
                // actions based on whether notifications were authorised or not
                guard error == nil else {
                    //Display Error.. Handle Error.. etc..
                    return
                }
                if granted {
                    //Do stuff here..
                }
                else {
                    //Handle user denying permissions..
                }
            }
            application.registerForRemoteNotifications()
  • Now you are done with registering remote notifications.
    notifications

Step 4: Add Notification Service Extension

  • Now we need to add ‘Notification Service Extension’ in application. For that open this screen first
    notifications
  • Select ‘Notification Service Extension’ in your application and click on ‘Next’ button
    notifications
  • Enter name of the extension. Here we have entered ‘Service Extension’. Then click on ‘Finish’ button.
    notifications
  • Once you click on ‘Finish’ button, user will be able to see below screen.
    notifications
  • In this screen, Xcode is asking you to active scheme for this new extension. So you can use this scheme for building and debugging. Schemes can be chosen in the toolbar or Product menu. Please activate scheme for ‘Service Extension’.
  • Now you are done with adding notification service extension.

Step 5: Understanding what files you are getting after adding Notification Service Extension

In this extension, you will be able to find that there are total two files:

  • Info.plist
  • NotificationService.swift

Info.plist:

  • In plist file you have to mention what type of operation you want to perform by using Notification Service Extension. notifications

NotificationService.swift
In swift file you have to implement all operations which you like to handle as per supported type for Notification Service Extension.

  • You will see a couple of delegate method – one for receiving a notification request and one for handling the expiration of the service extension.
  • Now focussing on this ‘didReceiveRequestWithContentHandler’ method.
    notifications
  • Write below code in ‘didReceiveRequestWithContentHandler’ method.
    notifications

if let bestAttemptContent = bestAttemptContent {
            // Modify the notification content here...

            // Get the custom data from the notification payload
            if let notificationData = bestAttemptContent.userInfo["data"] as? [String: String] {

                // Grab the attachment
                if let urlString = notificationData["attachment-url"], let fileUrl = URL(string: urlString) {

                    // Download the attachment
                    URLSession.shared.downloadTask(with: fileUrl) { (location, response, error) in
                        if let location = location {

                            // Move temporary file to remove .tmp extension
                            let tmpDirectory = NSTemporaryDirectory()
                            let tmpFile = "file:".appending(tmpDirectory).appending(fileUrl.lastPathComponent)
                            let tmpUrl = URL(string: tmpFile)!
                            try! FileManager.default.moveItem(at: location, to: tmpUrl)
                            // Add the attachment to the notification content
                            if let attachment = try? UNNotificationAttachment(identifier: "", url: tmpUrl) {
                                self.bestAttemptContent?.attachments = [attachment]
                            }
                        }

                        // Serve the notification content
                        self.contentHandler!(self.bestAttemptContent!)
                        }.resume()
                }
            }
        }

  • It may seem like a lot is happening here, but it’s really straightforward. Initially we are exploring the notification’s payload for the dictionary named ‘data’ that contains the key ‘attachment-url’. If this key exists, we download the media at the URL specified in the key’s value.
  • The URLSession downloads the media to temporary storage and appends a .tmp file extension which we need to remove so that the application can infer the file type and display it. So to do this, we need to move the file to the application’s local File Manager and that’s it – our media is ready to be attached to the notification content, and served to the user.
  • Now focussing on this ‘serviceExtensionTimeWillExpire’ method.
  • This Called just before the extension will be terminated by the system
  • Use this as an opportunity to deliver your ‘best attempt’ at modified content; otherwise the original push payload will be used.
  • Now you are done with notification service rich notification.

Step 6: Registering device token for remote notifications

  • Now open AppDelegate.swift. For that open this screen first notifications
  • Create Data extension for getting the data to hexString.
    notifications

extension Data {
    func hexString() -> String {
        return self.reduce("") { string, byte in
            string + String(format: "%02X", byte)
        }
    }
}

  • Write code in ‘didRegisterForRemoteNotificationsWithDeviceToken’ method for getting device token
    notifications

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        let deviceTokenString = deviceToken.hexString()
        print("deviceToken :\(deviceTokenString)")
    }

  • Use device token for sending push notification.

Step 7: Run on your iOS Device

  • Now connect your device with your system.
  • Select ’NotificationDemo’ from the scheme and run. Once it is run on your device then stop it.
    notifications

Step 8: How to test

  • We mentioned that only certain notifications were intercepted by the Service Extension. So, how does iOS know which notifications to intercept? Well, you just add a mutable-content tag to your payload and set it to 1.
  • The final thing you need to do is to add the media attachment URL to the payload in its own dictionary that we’ve named ‘data’, but you can name it anything. Simply add a key-value pair to the dictionary and as long as the key you’ve used in your Service Extension is the same as the key here, you’re done!
  • The following is a Payload example,

{
	"aps": {
		"alert": {
			"title": "Pokemon Go",
			"subtitle": "iOS 10 support!",
			"body": "Now add more content to your Push Notifications!"
		},
		"mutable-content": 1
	},
	"data": {
		"attachment-url": "https://psprovocative.com/wp-content/uploads/2016/08/pokemon-go-heart-pokestopjpg-d1c6dba768e27a23-300x300.jpg"
	}
}

You can now send images, videos, audio, and GIFs in your iOS 10 Push Notifications! Simply change the URL to point to another media file and see the results for yourself.

  1. Text only
    notifications
  2. Image attachment
    notifications
  3. GIF attachment
    notifications
    notifications

Click To Download Full Source Code

Sandeep Joshi

Sandeep Joshi | iOS Developer

I’m Sandeep Joshi, A person who is ambitious and intensely interested in what I do. You'll quickly find that I do not merely develop software - I develop highly maintainable, elegant code that will save you enormous sums in the long run.

Bug Life Cycle in Software Testing

$
0
0

Any error, fault, gap in requirements or the unexpected output of the software application under test is called as Bug or Defect. Bugs can be found out at any stage during SDLC (Software development Life Cycle), it could be at the designing phase, requirements gathering, development phase, testing phase, user acceptance testing phase or by the end user while using the application.

Most of the bugs are logged during testing phase before the application goes live. Any bug which is missed during testing can cause huge loss to the business depending on the seriousness of the bug. Bug does have its own lifecycle from it is logged till the point it is closed. Here are the diagrammatic representation of Bug Life Cycle:

bug cycle

BUG Life cycle – Explanation:

During testing phase when a bug is given by tester then that bug is logged into bug reporting tool such as Sifter, JIRA, Bugzilla, etc. When a bug is logged into tool it has a default status as ‘NEW’.

Bug is assigned to the developer who is responsible for the bug, then developer will check the bug and decide whether the bug is valid or invalid. If developer found that bug is invalid then developer will comment on the bug with a proper explanation. Tester will either reopen it or close it based on the explanation given by the developer.

If bug is accepted by the developer then status of that bug is ASSIGNED and then developers fixes the bug and assigns it back to the tester to verify whether the bug is fixed as expected or not. Here the status of BUG is RESOLVED.

Further when a bug which is fixed, tester can now change its status to either VERIFIED or REOPENED, depending on whether the bug is fixed or not.

When the bug is fixed successfully and application is behaving properly, the status of that bug is changed to CLOSED. Sometimes, it may require additional level of review to close the bug, it could be the project management team or end user.

If the bug fix didn’t work as expected, then the tester changes the status from RESOLVED to REOPENED with the explanation for why it is still a bug.

After the bug is REOPENED, status is again changed to ASSIGNED and developer will fix the bug according to the requirements and again send it to the tester to verify the solved Bug.

Again if the bug fix worked as expected then tester will change its status to VERIFIED and CLOSED. If it still has some issues then cycle goes on till the bug is not RESOLVED or CLOSED.

If bug reported by tester or end user is unclear to any of the project team member then they may ask for more information about the bug at any state of the bug life cycle.

BUG Life cycle – Participants:

BUG Reporter (Tester): Bug reporter(Tester) validates the bug and enters the details of the bug into bug reporting tools. It’s his responsibility to set the correct subject, application component, bug description, bug priority and bug assignee. If needed, Bug reporter can attach required screenshots, video or any data file to clarify the bug details.

BUG Tracking tool: Bug reporting tool like Sifter, JIRA, Bugzilla, etc. track the cycle of BUG with its responsible bug group and bug details. This helps in preparing bug reports as well.

BUG Group: Bug Group is the people who can see the bug details. Always main participants are tester or end user who reported the bug, developer who is responsible for bug and the bug is assigned to him , project manager and QA manager. Other member can be added into BUG group as per the requirement.

BUG Owner(Developer): This is the person who is responsible for bug and owns the bugs. A bug owner checks if the bug description is proper and it is reproducible or not based on the given information, if not he may assign it back to the reporter(tester) asking for more information. Based on the priority of a bug, bug owner get the bug fixed and deliver the fix within the deadline of the project.

Karan Ram

Karan Rami | Jr. Quality Analyst

Karan is a Jr. Quality Analyst at Yudiz Solutions Pvt. Ltd - one of the leading Mobile Apps and Game Development companies. In his free time, he likes to play games and testing new scenarios of the games and testing the new apps regularly in different devices.

Getting Started with Character Design & Animation

$
0
0

Every awesome, adorable and our favourite cartoon characters are inspired by one idea and one idea alone. A character sketch is a quick rendering of your character. You must ask yourself questions about your character. Only you can answer those questions. Animation is the process of making the illusion of motion and change.

Character Design and Animation

Step1: Sketching

Character design comes in many styles, but they all start with the rough sketch.Think of a character sketch as the rough draft of your character. It’s a place where you can freely experiment.Creating fascinating characters is a process of getting to know them. Sketching the detailing of shadings and effective shadows of your character will be so helpful to digitalize your character. Sketching will be very useful to make your character more expressive.

char design

Step2: Digitalization of character

Digitalization of character is the most important step of your character designing. In this step colors will be added, effective shades and lights will be added which make your design more clear and appealing.You can do your digitalization with a Wacom tablet, Illustrator and Adobe Photoshop.

char design

char design

Step3: Walk Cycle of Character

It’s time to give movement to your character. A walk cycle is a series of frames or illustrations drawn in sequence that loop to create an animation of your moving character. The walk cycle is looped over and over, thus having to avoid animating each step again. Making smoothness of walk cycle will help you to stop showing that there are frames which are repeating over, again and again.

char design

Step4: Animation

The final step will be animation of your character where you finalize objects of walk cycle and make a perfect sequence of it and animate it.
Character animation is a series to quickly display your character positions in order to form a vision of the images being animate. You can create your character animation in many unique ways.

char design

I hope my article on character design and animation may help you to design your favourite character. Aspiring game designers at Yudiz Solutions Pvt. Ltd. follows these steps for character design and its animation because..

Hiren Gajjar

Hiren Gajjar | 2D Game Graphics Artist

Hiren Gajjar is the lead 2D game graphics artist at Yudiz Solutions Pvt. Ltd. - a leading mobile game design and development company. He loves to share 2D graphics tips and tricks to create clean and intellectual graphics.

How to integrate HTML with Ionic

$
0
0

Click To Download Full Source Code

Getting started with Ionic Framework

Ionic is an advanced HTML5 Mobile App framework which is built most probably using Angular JS and web technologies like HTML, CSS and Sass. It is also well known as Advanced HTML5 Hybrid Mobile App Framework.

Ionic framework is also useful to make Mobile App Designs. It has it’s own Grids, CSS Components, Icons Library etc kind of like “Bootstrap”.

Basic Folder structure needed for Startup

Basically the folder structure or folder hierarchy for Basic Ionic Startup is somewhat like Bootstrap’s folder hierarchy or same like any other Framework.

Please refer below screenshot for Folder Hierarchy:

ionic-folder-structure

Every Ionic app is a simple web page. The default index.html file has following structure:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Ionic Basic Demo</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <script src="lib/ionic/js/ionic.bundle.js"></script>
    <!-- Needed for Cordova/PhoneGap (will be a 404 during development) -->
    <script src="cordova.js"></script>
  </head>
  <body>
  </body>
</html>

Also, Ionic comes with compiled Javascript and CSS for mobile apps, optional Sass files and JS Framework extensions, along with a great icon pack.

More about Ionic Framework

As mentioned above Ionic has it’s own components, Icons has it’s amazing grid structure which helps developers to also create 5 Grid structure. That is somewhat impossible with Bootstrap or any other Responsive Framework that we all know. Let’s have a look to basic grid structure, CSS components, etc.

Basic Grid Structure for Ionic
Basically there are 12 Grid structure that we use. Here, for Ionic the default grid class is “col”. For example, if we want to create 2 columns side by side we have to add 2 blocks having class “col”.

Other than this there are some more classes for grids. Let’s have a look on it.

Explicit Column Percentage Class names

.col-10 10%
.col-20 20%
.col-25 25%
.col-33 33.3333%
.col-50 50%
.col-67 66.6666%
.col-75 75%
.col-80 80%
.col-90 90%

As shown in above table, we can assume how 5 Grid structure is possible with Ionic.

Let’s look at one example below:

If I want to create 2 columns one with 75% width and second with 25% width, how will I do this?

ionic-grid

Getting Started with Ionic App

Following are the basic steps to follow while creating your First App in Ionic:

Step 1:

Setup your project within any editor you used like Eclipse, Netbeans, etc.

ionic-screenshot-1

Step 2:

The default web page file i.e. index.html file already exists. Now if you want to create new page you just have to add HTML page in templates folder. The another important part is that when you create any HTML page in templates folder you have to add that file’s name as menu item in app.js file.

For example, Let’s create simple Login Page.

  1. First create login.html file in templates folder.
  2. Now go to js > app.js. In this file add following code snippet:

.state('app.login', {
      url: '/login',
      views: {
        'menuContent': {
          templateUrl: 'templates/login.html'
      }
   }
})

Which creates template url for you, also registers it as a menu item.

Step 3:

Now if you want to load login page every time when you open the link in browser then you just have to write following code.  It will load the login page as default page every time whenever you load the page in simple browser window.

$urlRouterProvider.otherwise('/app/login');

Here if you have to add another page you just have to rename /login with your specific template name.

Step 4:

Now What we have to do in login.html file ? Let’s have a look.

<ion-modal-view>
  <ion-content>
      <div class="text-center login-block">
          <form ng-submit="doLogin()">
          <div class="list">
                <label class="item item-input">
                      <input type="email" placeholder="Email address"/>
                </label>
                <label class="item item-input">
                      <input type="password" placeholder="Password"/>
                </label>
                <a ui-sref="app.change-password">Forgot Password ?</a>
                <a>Don’t have an account ?</a>
                <label class="item">
                      <button class="button button-block button-positive" type="submit">Login</button>
                </label>
              </div>
        </form>
      </div>    
  </ion-content>
</ion-modal-view>

Every time when we create new template we are suppose to write our code within

<ion-modal-view>
  <ion-content>
  </ion-content>
</ion-modal-view>

That’s it. Now you can play with HTML code within these two blocks.

Step 5:

Till now we have discussed about basic HTML structure with Ionic but what we have to do if we have to create menu with in Ionic.

Let’s have a look at following menu code.

<ion-side-menus enable-menu-with-back-views="false">
  <ion-side-menu-content>
    <ion-nav-bar class="bar-stable">
      <ion-nav-back-button>
      </ion-nav-back-button>

      <ion-nav-buttons side="left">
        <button class="button button-icon button-clear ion-navicon" menu-toggle="left">
        </button>
      </ion-nav-buttons>
    </ion-nav-bar>
    <ion-nav-view name="menuContent"></ion-nav-view>
  </ion-side-menu-content>

  <ion-side-menu side="left">
    <ion-header-bar class="bar-stable">
        <div class="header-inner">
            <a menu-close href="#/app/login" class="logout-btn">Logout</a>
        </div>
    </ion-header-bar>
    <ion-content>
      <ion-list>
        <ion-item class="register" menu-close href="#/app/register">
          Register
        </ion-item>
        <ion-item class="change-password" menu-close href="#/app/change-password">
          Change Password
        </ion-item>
      </ion-list>
    </ion-content>
  </ion-side-menu>
</ion-side-menus>

This will create the stable sliding menu for your app.

ionic-screenshot2

Step 6:

From all these above steps, the basic question arrives in every mind is how to test the stuff that we have done here with the help of browser. This is as simple as we have run any file in browser window. Just run the index.html file of your app in browser. When you run your index file the Login page is first loaded. If you want to run any other page just change the template name shown in address bar.

ionic-screenshot3

Click To Download Full Source Code

Hitarthi Suthar

Hitarthi Suthar | Sr. Web Designer

I am a Sr. Web Designer at Yudiz Solutions Pvt. Ltd. I am passionate about my work and I love to do Craft and Painting in my free time.

Getting Started With FLEXIBLE BOX

$
0
0

Click To Download Full Source Code

What is flexible box?

Flexbox (Flexible Box) is the new layout mode in CSS3. It does not use float to display the flex items side by side. It comprises of flex container and flex item/s. Flex Container is defined by assigning display: flex or inline-flex property. Its immediate items will now be flex items.
Browser Support: It is fully supported in first version mentioned in the below table:

Name Chrome Firefox Safari Internet Explorer Opera
Version 29.0
21.0(-webkit-)
28.0
18.0(-moz-)
9.0
6.1(-webkit-)
11.0
10.0 (-ms-)
17.0

Properties for Flex Container:

flex-direction:

It is used to display the items horizontally or vertically. It has following values:

  • row (default) – It aligns the flex items left-to-right.
  • row-reverse – It aligns the flex items right-to-left.
  • column – It aligns the flex items top-to-bottom.
  • column-reverse – It aligns the flex items bottom-to-top.

Example:

.flex-row { flex-direction: row; -webkit-flex-direction: row; }
.flex-row-reverse    { flex-direction: row-reverse; -webkit-flex-direction: row-reverse;}
.flex-column { flex-direction: column; -webkit-flex-direction: column; }
.flex-column-reverse{ flex-direction: column-reverse; -webkit-flex-direction: column-reverse;}

Screenshot1

flex-wrap:

It specifies whether the flex items should wrap or not. It has following values:

  • nowrap (default) – It is used to shrink flexible items to fit within the width of the flex container.
  • wrap – Flex items will be displayed into multiple rows/columns if needed.
  • wrap-reverse – As name represents it works in the same way as wrap but in reverse order.

Example:

.flex-wrap { flex-wrap: wrap; -webkit-flex-direction: wrap; }
.flex-wrap-reverse { flex-wrap: wrap-reverse; -webkit-flex-wrap: wrap-reverse;}

Screenshot2

flex-flow:

It is shorthand property of above two properties.

flex-flow: <flex-direction> || <flex-wrap>

Example:

.row-wrap { flex-flow: row nowrap; -webkit-flex-flow: row nowrap; }
.column-wrap { flex-flow: column wrap; -webkit-flex-flow: column wrap; }
.column-reverse-wrap-reverse    { flex-flow: column-reverse wrap-reverse; -webkit-flex-flow: column-reverse wrap-reverse; }

Screenshot3

justify-content:

This property aligns the flex items along main (horizontal) axis. Values are:

  • flex-start (default) – It aligns items to left end of the flex container.
  • flex-end – It aligns items to the right end of the flex container.
  • center – It center aligns items within the flex container.
  • space-around – As name suggests it will leave empty space around each flex items along the horizontal axis.
  • space-between – It will equally distribute the empty space between flex items but the first and last flex item will be aligned to the ends of flex container along the horizontal axis.

Example:

.flex-start { justify-content: flex-start; -webkit-justify-content: flex-start; }
.flex-end { justify-content: flex-end; -webkit-justify-content: flex-end; }
.center { justify-content: center; -webkit-justify-content: center; }
.space-around    { justify-content: space-around; -webkit-justify-content: space-around; }
.space-between     { justify-content: space-between; -webkit-justify-content: space-between; }

Screenshot4

align-items:

This property aligns the flex items along cross (vertical) axis. Values are:

  • stretch (default) – It stretches items between cross-start(top) and cross-end(bottom) of the flex container.
  • flex-start – It vertically aligns items to top of the flex container.
  • flex-end – It vertically aligns items to bottom of the flex container.
  • center – It is used to vertically center align the single row of flex items within the flex container.
  • baseline – As name suggest it vertically aligns the items based on its baseline.

Example:

.flex-start { align-items: flex-start; -webkit-align-items: flex-start; }
.flex-end { align-items: flex-end; -webkit-align-items: flex-end; }
.center { align-items: center; -webkit-align-items: center; }
.baseline { align-items: baseline; -webkit-align-items: baseline; }
.item:nth-of-type(1) { font-size: 50px; line-height: 60px;}

Screenshot5

align-content:

This property aligns the flex lines along cross (vertical) axis. Also note that wrapping of the flex items is needed for this property. Values are as follows:

  • stretch (default) – It stacks the items in row to distribute the free vertical space in which first row is stacked towards the cross-start.
  • flex-start – All flex items are stacked towards the cross-start (top) of flex container.
  • flex-end – All flex items are stacked towards the cross-end (bottom) of flex container with the free vertical space left above it.
  • center – It is used to vertically center align the rows of flex items across the cross-axis.
  • space-between – It will equally distribute the empty space between flex items but the first and last flex item will be aligned to the ends of flex container along the vertical axis.
  • space-around – As name suggests it will leave empty space around each flex items along the vertical axis.

Example:

.flex-start { align-content: flex-start; -webkit-align-content: flex-start; }
.flex-end { align-content: flex-end; -webkit-align-content: flex-end; }
.center    { align-content: center; -webkit-align-content: center; }
.space-around    { align-content: space-around; -webkit-align-content: space-around; }
.space-between     { align-content: space-between; -webkit-align-content: space-between; }

Screenshot6

Properties for flex item:

order:

This property is used to reorder the flex items. Default value is 0.

Example:

.item:nth-of-type(1) { order: 3; -webkit-order: 3; }
.item:nth-of-type(3) { order: 4; -webkit-order: 4; }
.item:nth-of-type(4) { order: 1; -webkit-order: 1; }
.item:nth-of-type(5) { order: 0; -webkit-order: 0; }

Screenshot7

flex-grow:

This property specifies the value by which flex items grow to cover the free space. If same value is given to all flexible items then all the flex item will be of same size. Default value is 0. Negative numbers are not allowed.

flex-shrink:

This property specifies the value by which item shrinks. Default value is 1 so all flex items shrink to fit within the flex container. Negative numbers are not allowed.

flex-basis:

This property specifies the width of the item. Default value is auto.

flex:

The flex property specifies the length of the item, relative to the rest of the flexible items inside the same container. The flex property basically defines the length of the item, relative to the other flex items inside the same container. It is shorthand property in CSS.

flex: flex-grow flex-shrink flex-basis;
Its default value is: flex: 0 1 auto;

Example:

.flex-container { flex-wrap: wrap; -webkit-flex-wrap: wrap; width: 600px; height: 150px; }    
.item { width: 60px; }
.item:nth-of-type(1) { flex: 1 0 40px; -webkit-flex: 1 0 40px; }
.item:nth-of-type(2) { flex: 0 1 50px; -webkit-flex: 0 1 50px; }
.item:nth-of-type(3) { flex-grow: 2; -webkit-flex: 2; }

Screenshot8

align-self:

This property allows to override the align-items property of flex container. Default value is auto.

Example:

.flex-container { width: 400px; height: 150px; }    
.item { width: 60px; }
.item:nth-of-type(1) { align-self: center; -webkit-align-self: center; }

Screenshot9

Click To Download Full Source Code

Priya Patel

Priya Patel | Jr. Web Designer

I am a Web Designer at Yudiz Solutions Pvt. Ltd. In my free time I learn new things about latest web design tools and techniques.

Navigation System in Unity3D

$
0
0

Introduction

The Navigation System allows character which can navigate the game world. It gives your characters the capacity to remember that they want to take stairs to attain 2nd floor, or to jump to recover from a ditch. The Unity NavMesh include the following:

  1. NavMesh is a path finding mesh which allows you to determine walkable area in a game world. It is often used to find path from one walkable location to another in game world.
  2. NavMeshAgent part helps you to make characters which maintains a strategic distance from each other while moving towards their goal.the game global the use of the NavMesh and they know how to avoid each other.
  3. Off-Mesh It is a number which represents at what height character can jump. For example jumping over a ditch, or a door before walking through it,
  4. NavMesh Obstacle NavMesh is an object that agent will avoid while navigating into the game World.

Building a NavMesh

The manner of creating a NavMesh from the extent is known as NavMesh Baking. All the objects that are static in the game world should be selected as Navigation Static. After check navigation, static click on bake button.

Step 1: All ground 3d Objects need to be selected as Static

Navigation System

Step 2: Go to Window > Navigation

Navigation System

Step 3: Select Object > All Check on Navigation Static And just hit Bake Button

Navigation System

After baking is done the blue surface area determines walkable surface in the game world.

Step 4: Now is the time to set our navMeshAgent that will walk on Blue Surface.

1. Create a cylinder: GameObject > 3D Object > Cylinder.

Navigation System

2. Set Transform Given below

Navigation System

3. Select Cylinder in hierarcy and Add Componet in inspector and then type nav mesh agent, it will add componet in cylinder.

Navigation System

4. Add Script to Cylinder AgentDirectionScript

Navigation System

5. Create empty game object, give name as destination and transform as shown below:

Navigation System

6. Add Code To the AgentDirectionScript

using UnityEngine;
using System.Collections;

public class AgentDirectionScript : MonoBehaviour
{
    //Reference of destination Transform
    public Transform destination;
   
    void Start()
    {
        //GetComponent of navMeshAgent
        NavMeshAgent agent = GetComponent<NavMeshAgent>();
        //Set destination of navmeshAgent
        agent.destination = destination.position;
    
    }        
}

7. Drag and Drop Destination Gameobject into AgentDirectionScript in destination

Navigation System

Now Hit play button, Nav Mesh Agent will automatically detect walkable area.

Milan Sadariya

Milan Sadariya | Jr. Game Developer

To create awesome experiences for serious gamers by leveraging my ability to work in a fast-paced environment with speed and accuracy, along with my course work and hands-on development experience.

7 most important bug reporting skills every QA agent should have

$
0
0

Overview

Every QA beginner have a question in their mind that “How to report a bug or which skills are required for that?”. Bug reporting requires a specific set of skills which are different from those needed in other areas such as development or design.

Software Development Matrix

The reason why QA is a special kind of profile is because it’s the one part that is in the middle of the software development matrix. They are working with developers, designers, product managers, users & clients.

The Role of QA is like a middle man. The middle man(i.e QA) is the one who in touch with alpha and beta testers,customers. They are also the ones that have to inform the web developer to change (fix) their code.
They are also the ones to inform the web designers that their design isn’t good enough for the end users.

qa-img

Quality Analyst communicates with the product team and makes sure they are on track to fix the existing bugs. All these people have a different plan of things to be done and it is up to QA to make sure that teams are working together and knows what needs to be done.

So what are some great bug reporting skills you should have?

Step 1: You need to have some basic tech skills.

As a tester, you are hired to test/check certain software or products thoroughly. You’re the one who’s following every little step and hint.

It really takes some great skills to find bugs, document them and provide a proper description of how to make them reproducible.

If you are a bit familiar with different programming languages then it’s an advantage for you. I’m not saying that you must be a genius , definitely not , just a bit familiar with programming languages so that you can communicate with developers in charge of fixing the issues.

Step 2: You need to be good at communication

To establish a strong business relationship effective communication is very important .So much money has been lost due to poor communication.

It’s so easy to guide a development team in the wrong direction by simply having a bad management or mismatch in terminology.

Step 3: You need to be diplomatic

As a tester, you must be able to work together with all types of people in an efficient manner.
You should be able to work with a bit of crankiest people here and there and get the job done in reasonable time.

Your open-minded culture of trial & error is absolutely key here.

Step 4: You need to be a good negotiator

Negotiation is a key component for QA agents and a part of their daily life.

In order to get things done in a reasonable time, negotiation skills are very important. Here’s why.

The developers are busy with their work, so they’ll have to fix the bugs within required time . That means there will be a lot of communication between QA and development on when and what should be done.

So, it will definitely help you in these situations, if you are a good negotiator.

Step 5: You have to be good at testing

You must have to be good at testing. Having a good understanding of STLC (Software Test Life Cycle), different testing concepts, Workflows, and technique is a very important.

If you don’t have that, you’re not the person suited for this role.

Step 6: You need to be a deep diver (deep tester)

When you’re dealing with finding bugs you should require a certain level of curiosity. If you don’t, your instructions are bound to be vague. So if you have a curious mind, then you can become a good tester.

As a bug reporter, you spent a lot of time on the product and you know all the details of the product. Be prepared to dive deep into your product for finding defects, so that end users can use a quality product.

Step 7: You need to understand your product as a consumer

The software has to fulfill a different function. Understanding the product requirements and their uses help the users is key to being able to communicate well with everyone.

When the bug reporter needs extra information from the user, it doesn’t really help to communicate in technical terms. When this happens, the bug reporter has to understand the product from an end user’s (consumer) point of view and what he or she was trying to do.

Conclusion

Problem reporting is a key component of the software development lifecycle. Accurate defect descriptions and valid verification all contribute to timely and complete problem resolutions. That means bugs are fixed quicker, so a better version of your software gets in customer’s hands as quick as possible.

Sanket Bumtaria

Sanket Bumtaria | Jr. Quality Analyst

I am Jr. Quality Analyst at Yudiz Solutions Pvt. Ltd. - a leading Mobile Apps and Game Development company. I am passionate about deep testing and provide a Quality Product to the end users. I like to play games and testing them with different scenarios. I like drawing in my free time.
Viewing all 595 articles
Browse latest View live