Search results

  1. fukurou

    XCode grimoire

    segue // these are links between story boards (activities) and they enable //switching between them create a segue by control drag from one segue to another : choose present modally name the segue : the cocoa class code : import UIKit class ResultViewController: UIViewController {...
  2. fukurou

    XCode grimoire

    Cocoa Touch Class // these are used to build extra activities not programmatically file->new file->Cocoa Touch Class and place the class in the controller directory select an activity from the story board : from the identity inspector set the selected activity class name to that of the...
  3. fukurou

    XCode grimoire

    add a 2nd activity object library (the +), search view controller adding views programmatically (view controller in this example (2nd activity)) controller dir->Rclick->new file->(ios tab) swift file import UIKit class SecondViewController: UIViewController { // this is a 2nd...
  4. fukurou

    🐦swift swift grimoire

    classes playground for multiple swift files : file->new->project->macOS->command line tool adding a file : right click project folder->new file->swift file help->developer documentation class example with clone method (called copy in the swift language) : class Enemy{ var health : Int...
  5. fukurou

    🐦swift swift grimoire

    type conversion let temp = String(format: "%0.2f", sender.value)
  6. fukurou

    🐦swift swift grimoire

    round decimal to 2 decimal places : let temp = String(format: "%.2f", value)
  7. fukurou

    🐦swift swift grimoire

    mutating struct properties : struct Person { // define two properties var name = "" var age = 0 mutating func birthday(){ self.age += 1 } } // create instance of Person var person1 = Person() person1.birthday() print(person1.age)
  8. fukurou

    🐦swift Left side of mutating operator isn't mutable: 'self' is immutable

    struct Person { // define two properties var name = "" var age = 0 func birthday(){ age += 1 } } // create instance of Person var person1 = Person() birthday attempts to change the struct from within the struct so you need to add the prefix mutating : struct Person {...
  9. fukurou

    TNMT coming to Nintendo Switch on June 16, 2022

    yeah, I feel sorry for those who sold their nintendo switch 🍹 :kek:
  10. fukurou

    XCode grimoire

    MVC packaging R_click swift file->new group from selection->name the folder (model view or controler) set custom function parameter name : func greeter(msg message: String){ print(message) } greeter(msg: "hey") set custom func with no parameter name : func greeter(_ message...
  11. fukurou

    XCode grimoire

    setting view background color sender.backgroundColor = UIColor.green rest to clear : sender.backgroundColor = UIColor.clear
  12. fukurou

    XCode grimoire

    adding a swift file these files are where to store classes and structures file->new file (cmd + n)->swift file or right click the 1st dir in the project->new file
  13. fukurou

    🐦swift swift grimoire

    Struct vs. Class in Swift struct is pretty much a constant you can modify (with fields) 1 it gets passes as a value not as a reference 2 init is optional for struct 3 struct does have inheritance
  14. fukurou

    🐦swift swift grimoire

    struct // define a structure struct Person { // define two properties var name = "" var age = 0 } // create instance of Person var person1 = Person() // access properties and assign new values person1.age = 21 person1.name = "Rick" print("Name: \(person1.name) and Age: \( person1.age) ")
  15. fukurou

    🐦swift swift grimoire

    multi array 2d: var cinema = [[Int]]() or var cinema = Array(repeating: Array(repeating: 0, count: 5), count: 5) N-dimensional arrays var cinemas = [[[Int]]]() var cinemas = Array(repeating: Array(repeating: Array(repeating: 0, count: 5), count: 5), count: 3) cinemaRooms[1][2][3] = 1 // the...
  16. fukurou

    🐦swift swift grimoire

    Ternary Operator in Swift condition ? expression1 : expression2
  17. fukurou

    XCode grimoire

    defraculating a label set lines to 0 to have it add lines instead of trumping long strings and auto shrink to a minimum font size (15 in this example) the bigger the string the smaller the font will be
  18. fukurou

    XCode grimoire

    defraculating a progress bar set the height to > 1 to make it fatter than set the color and BG color with the tint property : :hmm: to see what a var type is select it and click option key
Top