Skip to content

Instantly share code, notes, and snippets.

View yilmazedis's full-sized avatar
🎯
Focusing, new project on the way

Yılmaz Edis yilmazedis

🎯
Focusing, new project on the way
View GitHub Profile
//
// IncomingCall.swift
// Incoming Call Animation
import SwiftUI
struct IncomingCall: View {
@State private var isCalling = false
@emrcftci
emrcftci / generate_storyboard_names.sh
Last active November 9, 2023 15:38
Shitty script to generate storyboard names.
#!/bin/sh
# https://gist.github.com/cci-emciftci/0072ecdae6be33773cb5a7f47a38fa1e
# Internal Field Separator(IFS) doc
# https://www.baeldung.com/linux/ifs-shell-variable
echo 'Checking changes...'
# Line number in UIStoryboard+Additions.swift to be changed.
LINE_TO_BE_CHANGED=24
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
setupCollectionView()
}
func setupCollectionView() {
let searchCollectionView = UICollectionView(frame: .zero, collectionViewLayout: getCompositionalLayout())
@alexpaul
alexpaul / ScrollView.swift
Last active October 4, 2023 12:45
ScrollView programmatically. UIScrollView.
import UIKit
final class DetailView: UIView {
// setting up a scroll view
// 1. add scrollview
// 2. add content view
// 3. add subviews to content view
// Note: must set high priority of content view to low, default is 1000
@ezequieloliveiralima
ezequieloliveiralima / DBManager.swift
Created July 9, 2018 16:05
Generic Data Base Manager for Core Data
import UIKit
import CoreData
class DBManager {
private static var managedObjectContext: NSManagedObjectContext {
return (UIApplication.shared.delegate as! AppDelegate).persistentContainer.viewContext
}
class func create<E>(proccess: (_ object: E) -> Void) -> Bool {
do {
@michaelevensen
michaelevensen / PagingCollectionViewController.swift
Last active April 10, 2024 08:46
An example of perfectly paging horizontal UICollectionViewController with overflowing cells. Works great with Storyboard — no need to set any specific attributes, just add this Class to the Controller and set your desired size for the cells like you would normally.
import UIKit
private let reuseIdentifier = "Cell"
class CollectionViewController: UICollectionViewController {
/* Custom scrollView for paging */
let pagingScrollView = UIScrollView()
/* Return item size */
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@aruld
aruld / foreachlistset.dart
Created October 19, 2011 18:30
Dart forEach() on a List/Set
main() {
List<String> list = new List<String>();
list.add('one');
list.add('two');
list.add('twelve');
list.forEach((element) => print(element));
Set<String> set = Set.from(list);
set.forEach((element) => print(element));
}