Skip to content

Commit

Permalink
fix swiftlint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kosyloa committed Sep 14, 2023
1 parent 9bafc62 commit 9c1640a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
20 changes: 10 additions & 10 deletions DXFeedFramework/Native/Schedule/NativeSchedule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import Foundation

class NativeSchedule {
let schedule: UnsafeMutablePointer<dxfg_schedule_t>?

init(schedule: UnsafeMutablePointer<dxfg_schedule_t>?) {
self.schedule = schedule
}

convenience init(scheduleDefinition: String) throws {
let thread = currentThread()
let schedule = try ErrorCheck.nativeCall(thread,
dxfg_Schedule_getInstance2(thread, scheduleDefinition.toCStringRef()))
self.init(schedule: schedule)
}

convenience init(instrumentProfile: InstrumentProfile) throws {
let mapper = InstrumentProfileMapper()
let native = mapper.toNative(instrumentProfile: instrumentProfile)
Expand All @@ -32,7 +32,7 @@ class NativeSchedule {
mapper.releaseNative(native: native)
self.init(schedule: schedule)
}

convenience init(instrumentProfile: InstrumentProfile, venue: String) throws {
let mapper = InstrumentProfileMapper()
let native = mapper.toNative(instrumentProfile: instrumentProfile)
Expand All @@ -44,7 +44,7 @@ class NativeSchedule {
mapper.releaseNative(native: native)
self.init(schedule: schedule)
}

deinit {
if let schgedule = schedule {
let thread = currentThread()
Expand All @@ -53,32 +53,32 @@ class NativeSchedule {
&(schgedule.pointee.handler)))
}
}

public func getName() throws -> String {
let thread = currentThread()
let name = try ErrorCheck.nativeCall(thread, dxfg_Schedule_getName(thread, schedule))
return String(pointee: name)
}

public func getTimeZone() throws -> String {
let thread = currentThread()
let timeZone = try ErrorCheck.nativeCall(thread, dxfg_Schedule_getTimeZone(thread, schedule))
return String(pointee: timeZone)
}

public func getDayByTime(time: Long) throws -> ScheduleDay {
let thread = currentThread()
let day = try ErrorCheck.nativeCall(thread, dxfg_Schedule_getDayByTime(thread, schedule, time))
let scheduleDay = try createDay(thread, day)
return scheduleDay
}

public func getDayById(dayId: Int32) throws -> ScheduleDay {
let thread = currentThread()
let day = try ErrorCheck.nativeCall(thread, dxfg_Schedule_getDayById(thread, schedule, dayId))
return try createDay(thread, day)
}

private func createDay(_ thread: OpaquePointer?,
_ day: UnsafeMutablePointer<dxfg_day_t>) throws -> ScheduleDay {
let scheduleDay = ScheduleDay()
Expand Down
9 changes: 0 additions & 9 deletions DXFeedFrameworkTests/DXScheduleTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ final class DXScheduleTest: XCTestCase {
for session in day.sessions where [.afterMarket, .preMarket, .regular].contains(session.type) {
extendedHours.append(session)
}
let date = String(format: "%d-%02d-%02d", arguments: [day.year, day.monthOfYear, day.dayOfMonth])
var sessions = "\n"
day.sessions.forEach { sch in
sessions += "\(sch.startTime) \(sch.endTime) \(sch.type) \n"
}
print("\(date) \(day.holiday) \(day.shortDay) \(sessions)")

}
XCTAssert(sessionBreaks.count == 246)
XCTAssert(extendedHours.count == 300)
Expand All @@ -95,6 +88,4 @@ final class DXScheduleTest: XCTestCase {
// }
// }



}

0 comments on commit 9c1640a

Please sign in to comment.