Swift provides default placeholder property to UITextField but not to UITextView.
So if you need a multi-line editable text view, you don’t get a pretty placeholder. Here you will learn how to add placeholder text to UItextView.
Here we will show...
Post Top Ad
30 Oct 2017
28 Oct 2017
Argument of '#selector' refers to instance method that is not exposed to Objective-C | Add '@objc' to expose this instance method to Objective-C
After installing Xcode 9 and migrating to Swift 4 from Swift 3 , @objc inference warning comes like below:
The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use...
27 Oct 2017
Passing Data Using NotificationCenter in Swift 4
Passing data from one view controller to another view controller using Notification Center is an easy way when compared to delegate protocols.
Here we need add observer or listeners for getting new data to load. First we need to send data using post...
26 Oct 2017
Store and Retrieve Image Locally Swift - Image Cache without Libraries
Store images locally without using any other libraries. In this article we will store and retrieve images using our own code.
We are storing images in a Document Directory. It's different for each app, so we can store image inside Document Directory.
Create...
25 Oct 2017
Adaptive Autolayout Programmatically For iPhone X Using SafeAreaLayoutGuide - Swift 4
Adaptive Autolayout mainly used to choose various layouts in different devices with orientations. Here in this article we create two layouts, one is for Portrait orientation and second on is for Landscape orientation. Here we are doing mainly for iPhone...
23 Oct 2017
Premium Login UI/UX Design using Swift 4 Programmatically With Autolayouts
Now a days mobile apps are using premium UI/UX designs. Login screen UI/UX design itself says how the app is gonna look further.
In this article we are going to create following login screen. We are not gonna use storyboard.
The whole screen developed...
22 Oct 2017
Latest iOS Interview Questions & Answers 2018
Question 1:
class Person {
var name: String
var age: Int
init(name: String, age: Int) {
self.name = name
self.age = age
}
}
let person1 = Person(name: "John", age: 26)
var person2 = person1
person2.name = "Mike"
What's...
19 Oct 2017
Delegates Example in swift 4 | Pass Data with Delegation
Delegates are a design pattern that allows one object to send messages to another object when a specific event happens.
Delegate helps in passing data back from presented view controller(SecondVC) to presenting view controller(FirstVC).
Imagine...
18 Oct 2017
Convert String To Int, Float, Double in Swift 4
We can easily convert String to Int, Float, Double using swift language.
String to Int:
By using Int constructor we can convert as follow:
let ageString = "25"
if let age = Int(ageString) {
print(age)
} else {
print("Not a valid string...
17 Oct 2017
How to add TextField to Alert View in swift 4?
Adding UITextField to alertview became easy from swift 3 by using UIAlertController.
Here we will show step by step.
Step 1:
First create UIAlertController object with title and message as follow:
let alertVC = UIAlertController(title: "Enter...
16 Oct 2017
Concatenate/Merge Two Arrays into One Array in Swift 4
Append two arrays into a new array with Swift standard library's.
There are 5 different ways for merging arrays in swift. We may choose one of the five following ways according to your needs and requirements.
Sorting Arrays in Swift
1. +(_:_:)...
14 Oct 2017
Sorting Arrays in Swift 4 - iOS 11
Sorting Arrays using swift 4 is a simple using sorted() built-in method.
Here is a example for sorting an simple array containing string objects.
let friends = ["Sophia", "James", "Olivia", "Mike", "Nina"]
print(friends.sorted())
//output is '["James",...
12 Oct 2017
Convert One Date Format To Another Date Format Swift 4 - iOS
Converting a date string from one date format to another date format is an easy by using the following method:
Date Formats:
Following are the some Date Formats:
Thursday, Oct 12, 2017 - EEEE, MMM d, yyyy
10/12/2017 - MM/dd/yyyy
10-12-2017...
11 Oct 2017
Convert Date To String & Vice-Versa Swift 4 - iOS
Date To String:
For converting Date to String we are going to create extension for Date as follow:
extension Date
{
func toString( dateFormat format : String ) -> String
{
let dateFormatter = DateFormatter()
dateFormatter.dateFormat...
10 Oct 2017
Convert UTC Timezone To Local/Device Current Timezone and Vice-Versa Swift 4 - iOS
In this article we are going to convert UTC Date format to Current device date format.
UTC is the time standard commonly used across the world. The world's timing centers have agreed to keep their time scales closely synchronized - or coordinated -...
8 Oct 2017
Storing/Downloading/Deleting images or videos Using Firebase Cloud Storage
Cloud Storage for Firebase is a powerful, simple, and cost-effective object storage service built for Google scale. Firebase SDK adds Google security to file uploads and downloads for your Firebase apps, either if connectivity is slow or fast.
If...
7 Oct 2017
Safe Area Layout Guides Tutorial iOS 11
The layout guide representing the portion of your view that is unobscured by bars and other content. In iOS 11, Apple is deprecating the top and bottom layout guides and replacing them with a single safe area layout guide.
Bottom layout guide &...
5 Oct 2017
Firebase Cloud Firestore Example Project in iOS - Swift
Cloud Firestore is a scalable database like Firebase Realtime Database, it keeps your data in sync across client apps through real time listeners and offers offline support for mobile and web so you can build responsive apps that work regardless of...