Final IOS
Final IOS
Practical 1
Aim: Introduction to Swift programming language and X Code IDE. Write
swiftfunctions for following functionality.
Introduction to Swift:
Swift is a general-purpose programming language developed by Apple. It's used for
developing native iOS and macOS apps, as well as mobile and desktop apps, and cloud
services. Swift is also used for systems programming.
Introduction to Xcode:
Xcode is a free, integrated development environment (IDE) created by Apple for
developing software applications for Apple platforms like iPhones, iPad, MacBooks, etc. It
includes tools for writing, debugging, and testing software, as well as tools for managing
project files and resources. Every IDE consists of three parts: the editor, the debugger, and the
interface builder. The editor is the part where a programmer writes code. The debugger is the
part that informs a programmer of an error and helps him to rectify it. The interface builder is
the part where a programmer works on the visual elements of the app and integrates them with
the code.
Output:
else {
print("Given array is not a palindrome")
}
Output:
Practical 2
Aim: Write a program to create parent class Person and derive two classes
from it namely Student and Employee. Classes shall have following
attributes and methods:
a. Person -> name, age, gender, city, get(), set()
b. Student -> id, sem, div, sub1marks, sub2marks, sub3marks, result()
c. Employee-> id, designation, salary, gross_salary()
d. for gross_salary() consider following value: i. if salary < 10000 then
HRA=10%, DA=5%, PF=200 ii. if salary > 10000 then HRA=15%,
DA=7%, PF=10%.
Code:
class Person
{
var name:String
var age:Int
var gender:String
var city:String
init(name1:String, age1:Int, gender1:String, city1:String)
{
name=name1
age=age1
gender=gender1
city=city1
}
func get()
{
}
class Student : Person
{
var id: Int = 202203103520099
var sem: Int = 6
var div: Character = "c"
var m1: Int = 58
var m2: Int = 70
var m3: Int = 79
init()
{
super.init(name1:"Suhelkhan", age1:20, gender1:"Male", city1:"Surat")
}
func result() -> Int
{
let res = (m1+m2+m3)/3;
print("Result is "+"\(res)")
return res
}
}
print("Suhelkhan")
print("202203103520099")
class Employee : Person
{
var id:Int = 2
var des: String = "Im an
Employee" var sal: Double =
12000
var gsal:Double = 0
init()
{
CGPIT/CE/SEM-6/A/B/C MOBILE APPLICATION DEVELOPMENT (IOS)
Enrollment no:202203103520099
Output:
Practical 3
Aim: Create an iOS application to develop “Say Hello App”. Use TextField
to get user name as input. On tap of button, display user name with
hello in Label.
Code:
//
// ViewController.swift
// PR_3
//
// Created by bmiit on 05/01/24.
//
import UIKit
print.text = name.text
super.viewDidLoad()
}
}
Output:
Extra Practical 3
Code:
//
// ViewController.swift
// odd
//
// Created by bmiit on 12/01/24.
//
import UIKit
class ViewController: UIViewController
let t=Int(t1.text!)!
if(t%2==0)
l2.text="Even"
else
l2.text="Odd"
super.viewDidLoad()
}
}
Output: