Swift converting between UInt and Int

后端 未结 5 1168
我寻月下人不归
我寻月下人不归 2020-12-30 18:52

I have the following methods

var photos = [MWPhoto] = [MWPhoto]()

func numberOfPhotosInPhotoBrowser(photoBrowser: MWPhotoBrowser!) -> UInt {

    return          


        
5条回答
  •  旧巷少年郎
    2020-12-30 19:23

    // initializing Int
    var someInt: Int = 8
    someInt
    
    // Converting Int to UInt
    var someIntToUInt: UInt = UInt(someInt)
    someIntToUInt
    
    // initializing UInt   
    var someUInt: UInt = 10
    someUInt
    
    // Converting UInt to Int   
    var someUIntToInt: Int = Int(someUInt)
    someUIntToInt
    

提交回复
热议问题