CategoryiOS

Decodable in Swift 4

D

According to Apple Codable is “A type that can convert itself into and out of an external representation.” Encodable — for encoding Decodable — for decoding Codable — for both encoding as well as decoding Let suppose we need to decode json response of type as below, [ {               "name": "India",               "dial_code": "+91",               "code": "IN"             } ] For...

Higher Order Function in Swift PART 2

H

Let’s start with FlatMap where few point need to cover. So lets begin, Flatmap Flatmap is used to flatten a collection of collections. let temp_Dictionary = [["k1":"v1","k2":"v2"],["k3":"v3","k4":"v4"]] let flatMap_1 = temp_Dictionary.flatMap { $0 } //[(key: "k2", value: "v2"), (key: "k1", value: "v1"), (key: "k3", value: "v3"), (key: "k4", value: "v4")] It returns an array of tuples after...

Move View/ScrollView to keep TextField visible when keyboard appears!

M

There is a very common but tricky part comes while handling textfields position when keyboard appears. Its sometimes become headache for developers to handle such small but tricky issue. When keyboard appears then some textfields get covered and user can’t see while editing it. There are some solutions to handle this but many of them works only for the first time. And then doesn’t...

Integration of Chat Library and Firebase in iOS Project

I

Group chat is a very easy and good approach for having the communication in any mobile application. Today we are going to dive into an implementation of “Group Chat Using Firebase”. While implementing this functionality in mobile application the very important and challenging task is creating an UserInterface for chatting screen, so for designing this screen we will go with the...

Implement a drawing app in Swift

I

Implement smooth drawing in iOS using swift. A drawing app allows the user to draw on the screen with their finger. There are many companies  ask customers to sign on apple device when making purchases.  Steps — 1> create a custom class line for initializing values of start and end point of line import UIKit class Line{   var start : CGPoint   var end : CGPoint   init(start _start : CGPoint ...

Higher order functions in swift

H

As far as I understood, higher order functions are functions that takes another function/closure as argument and/or returns it. Higher order functions are simply functions that operate on other functions by either taking a function as an argument, or returning a function. Swift’s Array type has a few methods that are higher order functions: sorted, map, filter, and reduce. These methods use...

Virtual Assistant

V

A virtual assistant is a software agent that can perform tasks or services for an individual. Sometimes the term “chatbot” is used to refer to virtual assistants generally or specifically those accessed by online chat (or in some cases online chat programs that are for entertainment and not useful purposes). As of 2017, the capabilities and usage of virtual assistants is expanding rapidly...

Alternative for xib in swift3 iOS

A

Hi all, Lets see the simplest and best way to replace or avoid use of xib by using UIView on storyboard.    Go on storyboard ,select Viewcontroller Drag UIView and drop it between FirstResponder and exit button on that.  Add IBOutlet of that UIView on ViewController.swift file.  set the center, width, height for that UIView  Refer Following code :   ——– IBOutlet...

Save and Load from KeyChain | Swift 4

S

import Cocoa import Security // see // Arguments for the keychain queries let kSecClassValue = NSString(format: kSecClass) let kSecAttrAccountValue = NSString(format: kSecAttrAccount) let kSecValueDataValue = NSString(format: kSecValueData) let kSecClassGenericPasswordValue = NSString(format: kSecClassGenericPassword) let kSecAttrServiceValue = NSString(format: kSecAttrService) let...

Quick Actions In Swift

Q

Apple has added quick actions to the app icon so users can deep link into an area of your app quicker. By pressing the app icon of the latest devices, the user obtains a set of quick actions. When the user selects a quick action, your app activates or launches and your app delegate object receives the quick action message. DEFINE QUICK ACTIONS In app’s Info.plist file create a...

Category