Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class likesObject: NSObject {
- // This is where I created the loop to solve for the total amount of likes
- func complimentsLikeTotal() -> Void {
- let monthlyLikes = [20, 15, 13, 32, 14, 38]
- var totalLikes = 0
- var runTotal = 0
- while runTotal < monthlyLikes.count {
- totalLikes += monthlyLikes[runTotal]
- print(totalLikes)
- runTotal += 1
- }
- }
- /*
- This is where I created the function to return how many all time likes there are in a phrase
- I want to use this function in the viewcontroller code on the label
- */
- func display() -> String {
- return "(complimentsLikeTotal) all time likes"
- }
- }
- import UIKit
- class ViewController: UIViewController {
- @IBOutlet weak var inputLikesLabel: UILabel!
- override func viewDidLoad() {
- super.viewDidLoad()
- // Here is where I don't know what to do with display and how to link it with the label
- self.inputLikesLabel.text = display
- }
- }
Add Comment
Please, Sign In to add comment