Powered by
Powered by
HuntMyIdeas-Inspire You To Make It Happen
Follow
   Me
  • Blogs
  • About Me
  • Home

Swift Interview Questions And Answers part 1

3/25/2016

Comments

 
Picture
​An NSMutableArray is an NSArray is a subclass of NSArray.But,we can really
​another immutable instance by the following way.In this post, I have shared some examples - how to turn a swift Array to Mutable Array or vice versa.This is my first article in swift for the beginners.Feel free to share your comments.
1.How to convert NSMutableArray to Swift Array in swift?
​

Answer:
​

var myMutableArray = NSMutableArray(array: ["xcode", "eclipse", "net bins"])

​
var myswiftArray = myMutableArray as NSArray as! [String
]
2.How to convert NSArray to NSMutableArray in swift?

Answer:


We can convert the SwiftArray to a MutableArray by using the following code.

let myArray: NSArray = ["iOS","Android","PHP"]
var myMutableArray = NSMutableArray(array:myArray)

print(myMutableArray)



3.How to convert an array of characters into string in Swift without using any separator?

Answer:


let SwiftCharacterArray: [Character] = ["a", "b", "c", "d"]
let SwiftString = String(characterArray)

print(SwiftString)

4.How to convert an array of Strings into a string in Swift without using any separator?
Answer:


let SwiftStringArray = ["cocos2d", "cocos2d-x", "UIKit"]
 let SwiftCharacterArray = SwiftStringArray.flatMap   { String.CharacterView($0) }
 let SwiftString = String(SwiftCharacterArray)

 print(SwiftString)


5.How to convert an array of Strings into a string in Swift using space as separator?
Answer:

let SwiftStringsArray = ["Model", "View", "Controller"]
let MySwiftString = SwiftStringsArray.joinWithSeparator(" ")

print(MySwiftString)



6.How to convert an array of Strings into a string in Swift using separator?
Answer:

let SwiftStringsArray = ["iPhone", "iPad", "iPod"]
let MySwiftString = SwiftStringsArray.joinWithSeparator(",")
print(MySwiftString)


6.How to convert Swift String into an Array?
Answer:

let Ustring : String = "iOS Developer Questions"
let characters = Array(Ustring.characters)
print(characters)

Read:
An Introduction To The Swift Programming Language
Swift 2 Tutorial Part 2: Basics
How to Integrate Google Signin SDK in iOS Application using Swift 
How To Add  A SWIFT Bridging Header in iOS


​
Comments

    Enter your email address:

    Delivered by FeedBurner

    RSS Feed

    Archives

    December 2017
    November 2017
    October 2017
    August 2017
    April 2017
    July 2016
    June 2016
    May 2016
    April 2016
    March 2016
    February 2016
    December 2014
    November 2014
    October 2014
    September 2014
    August 2014
    July 2014
    June 2014


    ​​Categories

    All
    Affiliate Marketing
    Alexa Rank
    Apple's Latest Updates
    Blog Tips
    Google AdSense Tips
    Grab-some-ultimate-ideas
    How-to-create-a-twinkling-star-background-effect-in-ios
    In-App Purchase Tutorial In Cocos2d-x (C++) Using SDKBOX
    Ios Interview Questions And Answers
    IOS Multiple Choice Questions And Answers
    Online Business
    Secrets To Effective IPhone App Marketing
    SEO Tips
    Swift Interview Questions
    Swift Tutorials
    Top 10 Articles Objective C
    Top 10 Articles-Objective-C
    Top 10 Popular Movies Ever
    Top 10 Popular Things To Know
    Top 10 Ultimate Issues Xcode
    Top 400 IOS Interview Questions
    Top IOS Sample Projects To Learn From
    Top Secrets To App Marketing
    UICollectionView
    Unity 3D

WELCOME TO HUNTMYIDEAS

Picture
I am Jitendra Gochhayat,an iOS Developer,Designer,blogger,
​from Odisha,India.
I write about ​​​blog tips and,
Make money online Tips,
​Objective C tutorials
SUSCRIBE TO NEWSLETTER

    Subscribe to this blog and receive notifications of new posts by email

Suscribe
Picture
Picture
Picture
Picture
Picture
HuntMyIdeas-2016 Powered By Weebly
Picture
Powered by Create your own unique website with customizable templates.
Powered by
Powered by