Skip to content

Instantly share code, notes, and snippets.

View Margels's full-sized avatar
🏠
Working from home

Margels Margels

🏠
Working from home
View GitHub Profile
{
"options": [
{
"description": "Andare in India per %@",
"needsCompletionSentence": true,
"completion-sentence": [
{
"description": "un mese",
"value": 0
},
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(windowScene: windowScene)
let viewController = ViewController()
// TODO 2
window?.rootViewController = viewController
// TODO 1
window?.makeKeyAndVisible()
import UIKit
import CometChatPro
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// set up the scroll view
func setupSlideScrollView(slides: [presentationSlide]) {
// set up the scroll view for its actual content (the screen + the rest of the slides)
presentationScrollView.contentSize = CGSize(width: view.frame.width * CGFloat(slides.count),
height: view.frame.height - 100)
// enable paging so the user can only scroll through pages
presentationScrollView.isPagingEnabled = true
// set x position for each slide and add to scroll view
// get the x position of each slide in the scroll view's width
func getIntervals(pages: Int) -> [CGFloat] {
var intervals: [CGFloat] = []
// scroll view's left edge is 0, right edge is 1
for i in stride(from: 0.0, through: 1.0, by: (1/(CGFloat(pages)-1))) {
// multiply and divide by 100 to switch between Int and CGFloat
// create the slides
func getSlides(completion: @escaping (Bool) -> ()) {
for i in 0..<slides.count {
// use the xib file created for the slide
let slide: presentationSlide = Bundle.main.loadNibNamed("presentationSlide",
owner: self,
options: nil)?.first as! presentationSlide
// set up the labels
class ViewController: UIViewController {
@IBOutlet var presentationScrollView: UIScrollView!
@IBOutlet var presentationPageControl: UIPageControl!
@IBOutlet var backgroundImageView: UIImageView!
@IBOutlet var continueButton: UIButton!
// prepare slides
var presentationSlides: [presentationSlide] = []
class ViewController: UIViewController {
@IBOutlet var presentationScrollView: UIScrollView!
@IBOutlet var presentationPageControl: UIPageControl!
@IBOutlet var backgroundImageView: UIImageView!
@IBOutlet var continueButton: UIButton!
override func viewDidLoad() {
extension Int {
// to base 10 from base <10
func base10(fromBase originalBase: Int, completion: @escaping (Int)->()) {
// get each digit
let s = String(self)
let digits = s.compactMap{ $0.wholeNumberValue }
print(digits)
// shadow on the right, label starts appearing, light effect view makes view darker
func rightShadow() {
UIView.animate(withDuration: 1, delay: 0, options: .curveEaseIn) {
self.label.alpha = 0.75
self.shadowView.alpha = 0.6