Skip to content

Instantly share code, notes, and snippets.

View oguzhanvarsak's full-sized avatar

Oguzhan Varsak oguzhanvarsak

  • Motorola Solutions
  • Kraków, Poland
  • 16:27 (UTC +01:00)
View GitHub Profile
@oguzhanvarsak
oguzhanvarsak / installApp.sh
Last active August 15, 2023 16:28
Install the App to Simulator Using xcodebuild
# This script creates the .app file from the project,
# saves it into a path,
# runs the simulator
# and installs the app.
#!/bin/bash
xcodebuild -workspace <workspace name>.xcworkspace \
-scheme <scheme name> \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 14,OS=16.4' \
@oguzhanvarsak
oguzhanvarsak / AlertViewWithImageView.swift
Created January 21, 2022 12:41
Alert View contains an Image View inside.
let showAlert = UIAlertController(title: "<#Title#>", message: "<#Message#>", preferredStyle: .alert)
let imageView = UIImageView(frame: CGRect(x: <#Int#>, y: <#Int#>, width: <#Int#>, height: <#Int#>))
imageView.image = <#UIImage#>
showAlert.view.addSubview(imageView)
let height = NSLayoutConstraint(item: showAlert.view, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: <#Int#>)
let width = NSLayoutConstraint(item: showAlert.view, attribute: .width, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1, constant: <#Int#>)
showAlert.view.addConstraint(height)
@oguzhanvarsak
oguzhanvarsak / SecurityCodeTextField.swift
Last active January 21, 2022 12:40
Alert View contains Security Text Field that auto detects verification code from Messages.
/* The verification code SMS must follow this model:
* "Your verification code: XXXXXX"
* You can localize it
* "Doğrulama kodunuz: 123456"
* but the important part is;
* the ":" character and the code must position at the end.
* Otherwise the textfield won't recognize it.
*/
let ac = UIAlertController(title: "Verification Code", message: "Enter the code.", preferredStyle: .alert)
@oguzhanvarsak
oguzhanvarsak / questions.md
Last active October 20, 2024 17:33
Interview Questions for iOS Developers

Interview Questions for iOS Developers

1. Classes vs structs

In Swift, structs are value types whereas classes are reference types. When you copy a struct, you end up with two unique copies of the data. When you copy a class, you end up with two references to one instance of the data. It’s a crucial difference, and it affects your choice between classes or structs. (+ Class extendable, struct does not.)

2. What’s the difference between var and let? Which one would you choose for properties in a struct and why?

Both let and var are for creating variables in Swift. let helps you create immutable variables (constants) while on the other hand var creates mutable variables.

3. What does the mutating keyword mean?

The mutating keyword lets callers know that the method is going to make the value change.

@oguzhanvarsak
oguzhanvarsak / Event.pass
Created August 24, 2021 14:08
Birthday Party PKPass
{
"formatVersion" : 1,
"passTypeIdentifier" : "pass.com.oguzhanvarsak.event",
"serialNumber" : "nmyuxofgna",
"teamIdentifier" : "XXXXXXXXX",
"webServiceURL" : "https://example.com/passes/",
"authenticationToken" : "XXXXXXXXXXX",
"relevantDate" : "2021-08-28T00:00-18:00",
"locations" : [
{
@oguzhanvarsak
oguzhanvarsak / team-passtype.pass
Created August 24, 2021 13:51
Pass Type Identifier and Team ID Template
{
...
"passTypeIdentifier" : "
your pass type identifier
",
"teamIdentifier" : "
your Team ID
",
...
}
@oguzhanvarsak
oguzhanvarsak / relevantinfos.pass
Created August 24, 2021 13:17
Relevant Informations Template
{
...
"description" : "Example pass showing relevance information",
"locations" : [
{"latitude" : 37.3229, "longitude" : -122.0323},
{"latitude" : 37.3286, "longitude" : -122.0143},
{
"altitude" : 10.0,
"latitude" : 37.331,
@oguzhanvarsak
oguzhanvarsak / barcodefield.pass
Last active August 24, 2021 12:38
Barcode field
{
...
"barcodes" : [
{
"message" : "ABCD 123 EFGH 456 IJKL 789 MNOP",
"format" : "PKBarcodeFormatQR",
"messageEncoding" : "iso-8859-1"
}
]
@oguzhanvarsak
oguzhanvarsak / backfields.pass
Created August 24, 2021 12:24
Back Fields Pass Template
{
...
"backFields" : [
{
"key" : "frequent-flier-number",
"label" : "Frequent flier number",
"value" : "1234-5678"
},
{
{
"description" : "Boarding pass for October 4, San Francisco to London",
"formatVersion" : 1,
"passTypeIdentifier" : "pass.com.example.boarding-pass",
"serialNumber" : "123456",
"boardingPass" : {
"primaryFields" : [
{
"key" : "origin",
"label" : "San Francisco",