Skip to content

Instantly share code, notes, and snippets.

View oguzhanvarsak's full-sized avatar

Oguzhan Varsak oguzhanvarsak

View GitHub Profile
@oguzhanvarsak
oguzhanvarsak / interview-questions-for-iOS-developers.md
Last active April 23, 2026 20:03
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 / CircularDoublyLinkedList.c
Last active June 4, 2024 15:44
Circular Doubly Linked List - Dairesel Çift Yönlü Bağlı Liste
/*
*************** RAPOR ***************
Onceki odevde ogrendigim gibi C++'da main() fonksiyonunu diger fonksiyonlar içerisinden cagirilamayacagindan tamamen C'ye gecmeye karar verdim.
Cogu kodu Doubly Linked List kodumdan aldim ve kullandim.
Silme isleminde tam cozemedigim bir durumdan dolayi tamamlayamadim. Kod sadece silinen degeri en sona atiyor. O kisim biraz karisikti bu yuzden bu sekilde biraktim.
Bu sefer node olusturmak icin ayri bir fonksiyon olusturdum. Arama ve Silme icin her olusturdugumda bir deger arttirdim.
Bu sayede DLL odevinde kullandigim while(temp->next != NULL) dongude en sona gelindiginde basa donme durumundan kurtulmak istedim.
Yeni bir for dongu kullanimi ogrendim, bu sekilde daha guzel gorundugunu dusundugumden cogunlukla for dongulerini o sekilde kullandım.
for (temp = head, i = 0;i < number;i++,temp = temp->next)
@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' \
{
"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",
@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 / 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"
}
]