SWIFT reporting "Extra argument in call" - works in Playground

SWIFT reporting "Extra argument in call" - works in Playground

By : user2956883
Date : November 22 2020, 03:03 PM
This might help you Under //Actions (line 16) I have a function call that takes two arguments and returns two variables. When I wrote and tested the block of code in Playground I had no errors; when I typed the code into Swift I am getting an error stating: "Extra argument in call" , Change the name of your dealHand function to :
code :
func dealNewHand(oldDeck: [String], oldHand: [String]) -> (newDeck: [String], newHand: [String])
var cards = dealNewHand(deck, hand)

Share : facebook icon twitter icon
"Extra argument 'complete' in call" when passing Swift closure

"Extra argument 'complete' in call" when passing Swift closure

By : user2840797
Date : March 29 2020, 07:55 AM
I hope this helps you . Neither. It's not a Swift bug, and you're not missing anything - because in fact you've solved the problem correctly!
The issue is that, as a shortcut, if an anonymous function consists of just one line, Swift tries to use that as the return value. That return value, however, is invalid for a (Bool) -> Void.
code :
UIView.animatePressed(messagesImage, complete: { _ in
UIView.animatePressed(messagesImage, complete: { _ in
    return self.delegate.newSubViewControllerRequested(UIStoryboard.messageListViewController()!)
Swift Method - Multiple Parameters "extra argument in call" Error

Swift Method - Multiple Parameters "extra argument in call" Error

By : MoC
Date : March 29 2020, 07:55 AM
To fix the issue you can do Well the first issue is that SaveMethod is an instance method .i.e should be called on an instance and not the class. The compiler is telling you there is an extra argument because when you call an instance method on the class of this instance it is expecting you to provide the instance which the method should bind to. For example:
code :
let myClipManager = ClipManager()
let mySaveMethod = ClipManager.SaveMethod(myClipManager)
let currentRecord = mySaveMethod(publicDB, myRecord: myRecord)
let myClipManager = ClipManager()
let currentRecord = myClipManager.SaveMethod(publicDB, myRecord: myRecord)
func saveRecord(record: CKRecord, inDatabase: CKDatabase){}
// call the method
saveRecord(myRecord, inDatabase: myDatabase)
func saveRecord(record record: CKRecord, inDatabase: CKDatabase){}
// the method should be called like this
saveRecord(record: myRecord, inDatabase: myDatabase)
func saveRecord(record aRecord: CKRecord, inDatabase db: CKDatabase) {
   // to use the passed record you should use the aRecord variable
   // to use the passed database you should use the db variable
   save(aRecord, db)
// but the method should be called in the following way
saveRecord(record: myRecord, inDatabase: myDatabase)
func saveRecord(record: CKRecord, _ db: CKDatabase) {}
// call the method
saveRecord(myRecord, myDatabase) // you don't have to name the second parameter because of the _ before its name
Swift "Extra Argument in Call" error when using .append to an array of classes

Swift "Extra Argument in Call" error when using .append to an array of classes

By : Estiven
Date : March 29 2020, 07:55 AM
To fix this issue You need to make an initializer for your "person" class.
Note that you can set default values for the initializer parameters too. This way you won't have to use the defaults in several places (you can even omit the default parameters in other initializers).
code :
class Person {

    var name:String
    var description:String
    var presentIdeasDict:[Int: String]
    var presentLinkDict:[Int: String]

    init(name: String = "Default", description: String = "Default", presentIdeasDict: [Int: String] = [0: "nil"], presentLinkDict: [Int: String] = [0: "nil"]) {
        self.name = name
        self.description = description
        self.presentIdeasDict = presentIdeasDict
        self.presentLinkDict = presentLinkDict


class PersonManager {

    var people = [Person]()

    func addPerson(name: String, description: String) {
        people.append(Person(name: name, description: description))

Swift playground error: extra argument 'timeout' in call

Swift playground error: extra argument 'timeout' in call

By : Ray Hammond
Date : March 29 2020, 07:55 AM
like below fixes the issue As noted by Shripada:
code :
XCTWaiter.wait(for: [expectation], timeout: 10.0)
Swift Extra argument "width" in call in CGRect

Swift Extra argument "width" in call in CGRect

By : Glory Samwel
Date : March 29 2020, 07:55 AM
it should still fix some issue I am trying to add a few buttons in the code and i get an error "Extra argument "width" in call" , my mistake i had to cast all the arguments to CGFloat
Related Posts Related Posts :
  • Update tableView row from AppDelegate Swift 4
  • Assigning return value of a class method to a variable error
  • how to display circular progress in delphi ios apps?
  • I can't figure how to fix this Expected identifier or '('
  • How to Test APIs in Swift 4?
  • Link error /Build/Products/Debug-iphonesimulator file not found
  • working with a very large JSON object in iOS
  • Turn off part of the iPhone Screen
  • Phonegap 3.0 app with facebook login using xCode
  • How to add interstitial admob ads to my ios project
  • adding tapku calendar to ios app
  • Add an alertcontroller in a global swift file?
  • Take square image with Cordova (Phonegap) Camera API?
  • Amazon S3 policy allowing only upload not overwrite
  • How to change the UILabel content by tapping?
  • Adding checkmark to selected table cell also checks another table cell
  • UICollectionView cellForItemAtIndexPath indexPath row is nil
  • Resize and set quality on JPEG image while retaining EXIF in iOS
  • How to push rootviewcontroller in Ios
  • How to add UIBarbuttonItem at centre on UInavigationbar in iOS
  • Would this IOS device test crash be expected
  • PickerView not showing any values
  • How to set root view controller in storyboard animated with navigation controller programmatically
  • Can anyone suggest me the effective way to deal with s3 upload fail because of timezone difference issue?
  • Getting list of files in documents folder
  • Error while using Realm Object as a singleton. Is it a good idea?
  • inserting into SQLite database
  • More nodes than I should
  • Facebook IOS SDK navigate to another controller after login not working
  • Swift Array - use "Contains" of type AnyObject
  • Sidebar menu with indicate navigationbar on iOS
  • Programmatically set size of UIView from Storyboard
  • Navigation bar blink
  • Web services issue on POST method
  • Parse.com error 'Method not allowed when Pinning is enabled.' when I use a PFQueryTableViewController subclass
  • Swift can't send URLRequest at all?
  • No Provisiong profiles with a valid signing identity were found and Failed to locate or generate matching signing assets
  • iOS: how to set httponly flag for NSHTTPCookie
  • How to get the mac address of a beacon in objective-c without knowing its UUID, major and minor values?
  • tableView is not showing data from JSON in swift
  • iTunes reject app for date of birth
  • save data depending on passed value in swift
  • webview not showing on full Screen of iphone 6
  • Location Notification's based on Latest iOS Feature
  • Adjusting Height of UITableViewCell
  • How to show five digit unicode in iphone
  • unwind doesn't work
  • Confusion about coordinates, frames & child nodes in SpriteKit on iOS?
  • If Statements not being recognized by Xcode
  • readonly property in RubyMotion
  • 'No available types for source 1' when the app runs on my device(IPhone 6) swift
  • IOS:Remove view when clicked in background
  • Removing "\" from URL in iOS Swift
  • iOS - Send an email automatically (NOT from user's account)
  • The usage of NSNotificationCenter in the relationship of parent and children
  • When do Apple auto-renewable subscriptions renew?
  • Unknown large spacing between x-axis label and base of plot in core-plot
  • How do I change the displayed time format after NSTimer is initiated?
  • Swift JSON breaks when [ ] are used
  • Secure Memory For Swift Objects
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org