Is @IBAction just a syntax in Swift or does @Something mean a particular thing in Swift?
Is @IBAction just a syntactical difference in Swift or does it signify something specific.
Also, similar usage is seen in AppDelegate.swift where @UIApplicationMain is written.
- ios sdk stop multitouch functionality
- Connect object in .xib to existing IBAction
- How to define which button pressed if they both have same IBAction?
- Objective C: what is a “(id) sender”?
- how to access from UICollectionViewCell the indexPath of the Cell in UICollectionView
- How do I name and link an IBAction button created in a storyboard
Solutions Collect From Internet About “Is @IBAction just a syntax in Swift or does @Something mean a particular thing in Swift?”
attributes in swift.They have some special meaning for compiler.For eg:
main.swift file by compiler as entry point for application.From swift guide
Attributes provide more information about a declaration or type.
There are two kinds of attributes in Swift, those that apply to
declarations and those that apply to types.
Apply this attribute to a class to indicate that it is the application delegate. Using this attribute is equivalent to calling
the NSApplicationMain function and passing this class’s name as the
name of the delegate class.
If you do not use this attribute, supply a main.swift file with a main
function that calls the NSApplicationMain function. For example, if
your app uses a custom subclass of NSApplication as its principle
class, call the NSApplicationMain function instead of using this
Here is whole list of attributes in swift
From apple swift blog
In Xcode, Mac templates default to including a “main.swift” file, but
for iOS apps the default for new iOS project templates is to add
@UIApplicationMain to a regular Swift file. This causes the compiler
to synthesize a main entry point for your iOS app, and eliminates the
need for a “main.swift” file.
Alternatively, you can link in an implementation of main written in
Objective-C, common when incrementally migrating projects from
Objective-C to Swift.
write code in
main.swift.It will work as enty point for application
//main.swift import Foundation import UIKit UIApplicationMain(C_ARGC, C_ARGV,nil, NSStringFromClass(AppDelegate))
- Get most recent data point from HKSampleQuery
- Techniques for implementing -hash on mutable Cocoa objects
- Donate Feature inside iPhone app
- How to convert a UIView to an image
- Swift tableView Pagination
- Pragma to explicitly enable ARC?
- Declaring constants instead of literals in vertex shader. Standard practice, or needless rigor?
- Enrollment Challenge to retrieve UDID from iPhone
- Overlay an image over another image in iOS
- Adding multiple custom bar buttons to custom nav bar
- New @convention(c) in Swift 2: How can I use it?
- Creating custom UITableViewCell's within a Storyboard
- How to enumerate volumes on Mac OS X?
- Resize textField Based On Content
- Add a color picker to an iOS app