반응형
//오름차순 정렬
for stand in 0..<(intArrayDeviceRSSI.count - 1) { //스캔 작업 반복
var maxIndex = stand
for index in (stand + 1)..<intArrayDeviceRSSI.count { //스캔 작업 (stand가 0이면 1번 index부터 마지막 Index까지 돌며 최소값을 찾아야 하니까)
if intArrayDeviceRSSI[index] > intArrayDeviceRSSI[maxIndex] {
maxIndex = index
}
}
intArrayDeviceRSSI.swapAt(stand, maxIndex) //숫자형 배열 자리 바꿈
strArrayDeviceName.swapAt(stand, maxIndex) //위 계산 기반 문자열 이름 자리바꿈
strArrayDeviceRSSI.swapAt(stand, maxIndex) //위 계산 기반 문자열 감도 자리바꿈
searchPeripheral.swapAt(stand, maxIndex)
}
'iOS' 카테고리의 다른 글
[Swift] Lazy 변수 (0) | 2021.12.15 |
---|---|
[Swift] Storyboard 없이 코드로 프로젝트 시작하기 (0) | 2021.12.11 |
[Swift] UI 화면 안나타남 (0) | 2021.10.22 |
[Swift] 화면전환 방법 - 코드 (0) | 2021.10.20 |
[Swift] Back Button 코드 (0) | 2021.10.19 |