Core Data Displaying Attributes Individually From Log












0















so I have been trying to use Core Data with a logbook app that records information. In this case it is flying hours. So I input data and it uses Core Data to save/store is as a set value but I have only made it display a small amount of the saved info in the table view(see in code below).



What I need help with, it making it so I can click on each tableViewCell which goes to a VC where it has all the info which the user inputted into the app(as it is a logbook)



How will it be possible so that the user will see their specific info for that specific cell which have different info stored as they are all different logs



    func numberOfSections(in tableView: UITableView) -> Int {
return 1
}

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return logArray.count
}
//WHATS IN THE TABLE VIEW CELL FUNCTION/////
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let log = logArray[indexPath.row]
cell.textLabel!.text = "Flight:" + " " + log.date! + " Click For More Info -->"
return cell
}









share|improve this question



























    0















    so I have been trying to use Core Data with a logbook app that records information. In this case it is flying hours. So I input data and it uses Core Data to save/store is as a set value but I have only made it display a small amount of the saved info in the table view(see in code below).



    What I need help with, it making it so I can click on each tableViewCell which goes to a VC where it has all the info which the user inputted into the app(as it is a logbook)



    How will it be possible so that the user will see their specific info for that specific cell which have different info stored as they are all different logs



        func numberOfSections(in tableView: UITableView) -> Int {
    return 1
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return logArray.count
    }
    //WHATS IN THE TABLE VIEW CELL FUNCTION/////
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
    let log = logArray[indexPath.row]
    cell.textLabel!.text = "Flight:" + " " + log.date! + " Click For More Info -->"
    return cell
    }









    share|improve this question

























      0












      0








      0








      so I have been trying to use Core Data with a logbook app that records information. In this case it is flying hours. So I input data and it uses Core Data to save/store is as a set value but I have only made it display a small amount of the saved info in the table view(see in code below).



      What I need help with, it making it so I can click on each tableViewCell which goes to a VC where it has all the info which the user inputted into the app(as it is a logbook)



      How will it be possible so that the user will see their specific info for that specific cell which have different info stored as they are all different logs



          func numberOfSections(in tableView: UITableView) -> Int {
      return 1
      }

      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
      return logArray.count
      }
      //WHATS IN THE TABLE VIEW CELL FUNCTION/////
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
      let log = logArray[indexPath.row]
      cell.textLabel!.text = "Flight:" + " " + log.date! + " Click For More Info -->"
      return cell
      }









      share|improve this question














      so I have been trying to use Core Data with a logbook app that records information. In this case it is flying hours. So I input data and it uses Core Data to save/store is as a set value but I have only made it display a small amount of the saved info in the table view(see in code below).



      What I need help with, it making it so I can click on each tableViewCell which goes to a VC where it has all the info which the user inputted into the app(as it is a logbook)



      How will it be possible so that the user will see their specific info for that specific cell which have different info stored as they are all different logs



          func numberOfSections(in tableView: UITableView) -> Int {
      return 1
      }

      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
      return logArray.count
      }
      //WHATS IN THE TABLE VIEW CELL FUNCTION/////
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
      let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
      let log = logArray[indexPath.row]
      cell.textLabel!.text = "Flight:" + " " + log.date! + " Click For More Info -->"
      return cell
      }






      swift uitableview core-data






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 15 '18 at 11:49









      Riley LunzRiley Lunz

      387




      387
























          1 Answer
          1






          active

          oldest

          votes


















          0














          First create variable for log in your UITableViewCell



          var log: Log?


          now in cellForRowAt set log of cell independent on indexPath.row



          cell.log = logArray[indexPath.row]


          then create variable in second ViewController.



          var selectedLog: Log?


          Now in Table View delegate method didSelectRowAtperform segue with sender as that cell



           func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          self.performSegueWithIdentifier("yourIdentifier", sender: tableView.cellForRow(at: indexPath))
          }


          And finally in prepare for segue method declare destination ViewController as YourSecondViewController and set its selectedLogProperty



          override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
          if segue.identifier == "yourIdentifier" {
          let destinationVC = segue.destination as! YourSecond ViewController
          let senderCell = sender as! YourTableViewCell
          destinationVC.selectedLog = senderCell.log!
          }
          }





          share|improve this answer
























          • thanks so much, will see if works

            – Riley Lunz
            Nov 15 '18 at 12:14











          • @RileyLunz :-) If it helped, you could accept my answer

            – Robert Dresler
            Nov 15 '18 at 12:15













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53318845%2fcore-data-displaying-attributes-individually-from-log%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          First create variable for log in your UITableViewCell



          var log: Log?


          now in cellForRowAt set log of cell independent on indexPath.row



          cell.log = logArray[indexPath.row]


          then create variable in second ViewController.



          var selectedLog: Log?


          Now in Table View delegate method didSelectRowAtperform segue with sender as that cell



           func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          self.performSegueWithIdentifier("yourIdentifier", sender: tableView.cellForRow(at: indexPath))
          }


          And finally in prepare for segue method declare destination ViewController as YourSecondViewController and set its selectedLogProperty



          override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
          if segue.identifier == "yourIdentifier" {
          let destinationVC = segue.destination as! YourSecond ViewController
          let senderCell = sender as! YourTableViewCell
          destinationVC.selectedLog = senderCell.log!
          }
          }





          share|improve this answer
























          • thanks so much, will see if works

            – Riley Lunz
            Nov 15 '18 at 12:14











          • @RileyLunz :-) If it helped, you could accept my answer

            – Robert Dresler
            Nov 15 '18 at 12:15


















          0














          First create variable for log in your UITableViewCell



          var log: Log?


          now in cellForRowAt set log of cell independent on indexPath.row



          cell.log = logArray[indexPath.row]


          then create variable in second ViewController.



          var selectedLog: Log?


          Now in Table View delegate method didSelectRowAtperform segue with sender as that cell



           func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          self.performSegueWithIdentifier("yourIdentifier", sender: tableView.cellForRow(at: indexPath))
          }


          And finally in prepare for segue method declare destination ViewController as YourSecondViewController and set its selectedLogProperty



          override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
          if segue.identifier == "yourIdentifier" {
          let destinationVC = segue.destination as! YourSecond ViewController
          let senderCell = sender as! YourTableViewCell
          destinationVC.selectedLog = senderCell.log!
          }
          }





          share|improve this answer
























          • thanks so much, will see if works

            – Riley Lunz
            Nov 15 '18 at 12:14











          • @RileyLunz :-) If it helped, you could accept my answer

            – Robert Dresler
            Nov 15 '18 at 12:15
















          0












          0








          0







          First create variable for log in your UITableViewCell



          var log: Log?


          now in cellForRowAt set log of cell independent on indexPath.row



          cell.log = logArray[indexPath.row]


          then create variable in second ViewController.



          var selectedLog: Log?


          Now in Table View delegate method didSelectRowAtperform segue with sender as that cell



           func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          self.performSegueWithIdentifier("yourIdentifier", sender: tableView.cellForRow(at: indexPath))
          }


          And finally in prepare for segue method declare destination ViewController as YourSecondViewController and set its selectedLogProperty



          override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
          if segue.identifier == "yourIdentifier" {
          let destinationVC = segue.destination as! YourSecond ViewController
          let senderCell = sender as! YourTableViewCell
          destinationVC.selectedLog = senderCell.log!
          }
          }





          share|improve this answer













          First create variable for log in your UITableViewCell



          var log: Log?


          now in cellForRowAt set log of cell independent on indexPath.row



          cell.log = logArray[indexPath.row]


          then create variable in second ViewController.



          var selectedLog: Log?


          Now in Table View delegate method didSelectRowAtperform segue with sender as that cell



           func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
          self.performSegueWithIdentifier("yourIdentifier", sender: tableView.cellForRow(at: indexPath))
          }


          And finally in prepare for segue method declare destination ViewController as YourSecondViewController and set its selectedLogProperty



          override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
          if segue.identifier == "yourIdentifier" {
          let destinationVC = segue.destination as! YourSecond ViewController
          let senderCell = sender as! YourTableViewCell
          destinationVC.selectedLog = senderCell.log!
          }
          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 15 '18 at 12:06









          Robert DreslerRobert Dresler

          5,6681526




          5,6681526













          • thanks so much, will see if works

            – Riley Lunz
            Nov 15 '18 at 12:14











          • @RileyLunz :-) If it helped, you could accept my answer

            – Robert Dresler
            Nov 15 '18 at 12:15





















          • thanks so much, will see if works

            – Riley Lunz
            Nov 15 '18 at 12:14











          • @RileyLunz :-) If it helped, you could accept my answer

            – Robert Dresler
            Nov 15 '18 at 12:15



















          thanks so much, will see if works

          – Riley Lunz
          Nov 15 '18 at 12:14





          thanks so much, will see if works

          – Riley Lunz
          Nov 15 '18 at 12:14













          @RileyLunz :-) If it helped, you could accept my answer

          – Robert Dresler
          Nov 15 '18 at 12:15







          @RileyLunz :-) If it helped, you could accept my answer

          – Robert Dresler
          Nov 15 '18 at 12:15




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53318845%2fcore-data-displaying-attributes-individually-from-log%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()