This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"options": [ | |
{ | |
"description": "Andare in India per %@", | |
"needsCompletionSentence": true, | |
"completion-sentence": [ | |
{ | |
"description": "un mese", | |
"value": 0 | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
guard let windowScene = (scene as? UIWindowScene) else { return } | |
window = UIWindow(windowScene: windowScene) | |
let viewController = ViewController() | |
// TODO 2 | |
window?.rootViewController = viewController | |
// TODO 1 | |
window?.makeKeyAndVisible() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import CometChatPro | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
@IBOutlet var presentationScrollView: UIScrollView! | |
@IBOutlet var presentationPageControl: UIPageControl! | |
@IBOutlet var backgroundImageView: UIImageView! | |
@IBOutlet var continueButton: UIButton! | |
// prepare slides | |
var presentationSlides: [presentationSlide] = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
@IBOutlet var presentationScrollView: UIScrollView! | |
@IBOutlet var presentationPageControl: UIPageControl! | |
@IBOutlet var backgroundImageView: UIImageView! | |
@IBOutlet var continueButton: UIButton! | |
override func viewDidLoad() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
NewerOlder