53165

Swift - Editor placeholder in source file

Question:

I am new to swift and I was following an open source tutorial to learn Swift, however one error keeps cropping up - "Editor placeholder in source code" This is the code:

func setupGameLogic (){ for index in 0 ... fields.count - 1{ let gestureRecogniser = UITapGestureRecognizer(target: self, action: Selector("fieldTapped:")) gestureRecogniser.numberOfTapsRequired = 1 fields[index].addGestureRecognizer(gestureRecognizer: UIGestureRecognizer) //Editor placeholder in source file } }

Answer1:

This code is wrong:

fields[index].addGestureRecognizer(gestureRecognizer: UIGestureRecognizer)

When you are calling a method, you supply an argument value: you do not supply a type describing the required parameters. You want to say this:

fields[index].addGestureRecognizer(gestureRecognizer) <hr />

An editor placeholder is a solid rounded rectangle with text in it, inserted through code completion. It might look like this:

<a href="https://i.stack.imgur.com/pKuCh.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/pKuCh.png" data-original="https://i.stack.imgur.com/pKuCh.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

or this:

<a href="https://i.stack.imgur.com/saTO8.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/saTO8.png" data-original="https://i.stack.imgur.com/saTO8.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

You need to look for that sort of thing in your code and replace it with actual text (or delete it).

Answer2:

<a href="https://i.stack.imgur.com/sVgsN.png" rel="nofollow"><img alt="Code snippet" class="b-lazy" data-src="https://i.stack.imgur.com/sVgsN.png" data-original="https://i.stack.imgur.com/sVgsN.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

For example, if you left the blue place holder code in the file when you ran your program, it will give you this error. Try to delete it, then go to Product->Clean and Product->Build.

Recommend

  • App Closes On Clicking Google SIgn In Button
  • Column 'dbo.User.FB_UserId' is invalid in the select list because it is not contained in e
  • Selection Sort, For Java
  • How to click on a link that has a certain content in puppeteer?
  • Add custom field for WooCommerce CSV Export plugin - For customer first order [closed]
  • Rx produce and consume on different threads
  • How to make the tableview response pan gesture in ZUUIRevealController
  • How to get the index of element in the List in c#
  • Excel passing a range into a function
  • How to replace TouchesBegan with UIGestureRecognizer
  • how to remove a div with same ids but display='block' and display='none' in JAVa
  • Get all existing pointers to an object
  • Number of threads being used during Parallel.ForEach
  • Laravel lmutator $this->attributes return 'Undefined index: id'
  • Oracle ListaGG, Top 3 most frequent values, given in one column, grouped by ID
  • get all processes in parallel
  • Using an array for autofilter criteria
  • Is there any way to use wpdb prepare statements for array implode(' OR ', $myArray)?
  • Count from each distinct date, fill in missing dates with zero
  • Opaque reference instead of PImpl. Is it possible?
  • Count New Lines in Text File
  • Creating NSCollectionView with datasource programatically
  • SQL: Getting the physical size of a subset of a table
  • redirect_to root_url and return unless @user.activated
  • Getting the scrolling offset when storing coordinates
  • Bootstrap (v3.3.4) glyphicons not displayed in IE when refresh page (F5)
  • Add dynamic data to line chart from mysql database with highcharts
  • Implementing “partial void” in VB
  • Using Sax parsing to edit and write XML in VB6
  • Sending HTML Form Data to Spring REST Web Service
  • Jquery popup on mouse over of calendar control
  • Django: Count of Group Elements
  • Sending data from AppleScript to FileMaker records
  • MySQL WHERE-condition in procedure ignored
  • Shallow update not allowed (git > 1.9)
  • what is the difference between the asp.net mvc application and asp.net web application
  • jquery mobile loadPage not working
  • How to include full .NET prerequisite for Wix Burn installer
  • Qt: Run a script BEFORE make
  • Observable and ngFor in Angular 2