Search

results found tagged with search options user 1921348

Swift is a general-purpose, open-source programming language developed by Apple Inc. for their platforms and Linux. Use the tag only for questions about language features, or requiring code in Swift. Use the tags [ios], [osx], [watch-os], [tvos], [cocoa-touch], and [cocoa] for (language-agnostic) ...

12
votes
$0 is a shorthand name for first argument passed to closure. In this case, as you're mapping a Dictionary, that argument is a tuple - hence $0.0 is a key, and $0.1 is a valueFor more info on shorthand argument names, see Swift documentation on closures…
answered Sep 28 '17 by mag_zbc
5
votes
For Swift 3 just drop let before error if let data=data, error==nil {// do stuff}Before Swift 3 the syntax was a little different if let data=data where error==nil {}…
answered Aug 4 '17 by mag_zbc
2
votes
Don't declare your array as [AnyObject] because you clearly want to store a concrete type - Dictionary. Use instead var rows: [[String : AnyObject]]=[[:]]let firstLine: [String : AnyObject]=[ …
answered Jul 18 '17 by mag_zbc
0
votes
Instead of String{oldIncatYears}use String(oldIncatYears)
answered Oct 5 '17 by mag_zbc
3
votes
The answer is - dictionaries in those two cases are actually not identical.In second case, the value of dict["num"] in of Int type, because you explicitly assigned an Int to it.In first case howev …
answered Feb 9 by mag_zbc
2
votes
=newSequence[i]if(index==0){// we need to store the correct answer indexcurrentCorrectAnswerIndex=i}i +=1}do it the correct Swift way for (index, value) in newSequence.enumerated() {if value==0 {currentCorrectAnswerIndex=index}}…
answered Mar 15 by mag_zbc
4
votes
It has indeed been changed in Swift 3 $0.news.thumbUrl=request?.url?.absoluteString…
answered Sep 7 '17 by mag_zbc
1
vote
Unless a and b are instances of a class, your varToMutate will only be a copy, because everything besides a Class is a value-type in Swift. Maybe try UnsafeMutablePointer<T>?…
answered Jul 6 '17 by mag_zbc
1
vote
From documentation on becomeFirstResponder(): Never call this method on a view that is not part of an active viewhierarchy.So calling it from viewDidLoad is definitelly not a good idea. Tr …
answered Jul 13 '17 by mag_zbc
1
vote
Insert a subview in your button let circleFrame=CGRect(x: 0, y: 0, width: circleDimension, height: circleDimension)let circle=UIView(frame: circleFrame)circle.backgroundColor=UIColor.clear…
answered Oct 6 '17 by mag_zbc
0
votes
It will be perfectly round by rounding corners only if your view is a perfect square. If it is rectangular, you will need to use an elliptic shape layerlet shapeLayer=CAShapeLayer()shapeLayer.pat …
answered Mar 16 by mag_zbc
0
votes
'NSInternalInconsistencyException', reason: 'could not dequeue a viewof kind: UICollectionElementKindCell with identifier cell - mustregister a nib or a class for the identifier or connect a …
answered Jul 21 '17 by mag_zbc
2
votes
| is not a character allowed in URL. Try to percent escape the URL string let url=URL(string:"https://maps.googleapis.com/maps/api/directions/json?origin=colombo&destination=kandy&waypoints=opt …
answered Aug 4 '17 by mag_zbc
0
votes
1answer
I have an app with several view controllers, most of which should be able to have any orientation, but one is required to be in Portrait. However, the app ignores the value I return from supportedInte …
asked Nov 18 '16 by mag_zbc
1
vote
If you want it to work regardless of your device's regional settings, you need to set the locale property of your DateFormatterlet dateFormatter=DateFormatter()dateFormatter.locale=Locale(ident …
answered Apr 12 by mag_zbc

153050per page
angop.ao, elkhabar.com, noa.al, afghanpaper.com, bbc.com, time.com, cdc.gov, nih.gov, xnxx.com, github.com,