Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 4, 2022. It is now read-only.

Commit 3e7118a

Browse files
author
Viranchee
committed
Updated to Swift 4
1 parent efc9915 commit 3e7118a

File tree

11 files changed

+37
-17
lines changed

11 files changed

+37
-17
lines changed

‎LucidDreams.xcodeproj/project.pbxproj‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@
407407
developmentRegion = English;
408408
hasScannedForEncodings = 0;
409409
knownRegions = (
410+
English,
410411
en,
411412
Base,
412413
);
@@ -632,7 +633,7 @@
632633
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
633634
PRODUCT_BUNDLE_IDENTIFIER = com.viranchee.xj;
634635
PRODUCT_NAME = "$(TARGET_NAME)";
635-
SWIFT_VERSION = 3.0;
636+
SWIFT_VERSION = 4.0;
636637
};
637638
name = Debug;
638639
};
@@ -647,7 +648,7 @@
647648
PRODUCT_BUNDLE_IDENTIFIER = com.viranchee.xj;
648649
PRODUCT_NAME = "$(TARGET_NAME)";
649650
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
650-
SWIFT_VERSION = 3.0;
651+
SWIFT_VERSION = 4.0;
651652
};
652653
name = Release;
653654
};

‎LucidDreams.xcodeproj/xcuserdata/dev-heady.xcuserdatad/xcschemes/xcschememanagement.plist‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
<key>orderHint</key>
1010
<integer>0</integer>
1111
</dict>
12+
<key>LucidDreams.xcscheme_^#shared#^_</key>
13+
<dict>
14+
<key>orderHint</key>
15+
<integer>0</integer>
16+
</dict>
1217
</dict>
1318
</dict>
1419
</plist>

‎LucidDreams/Assets.xcassets/AppIcon.appiconset/Contents.json‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
313
{
414
"size" : "29x29",
515
"idiom" : "iphone",
@@ -35,6 +45,11 @@
3545
"idiom" : "iphone",
3646
"filename" : "AppIcon_180x180.png",
3747
"scale" : "3x"
48+
},
49+
{
50+
"idiom" : "ios-marketing",
51+
"size" : "1024x1024",
52+
"scale" : "1x"
3853
}
3954
],
4055
"info" : {

‎LucidDreams/Dream.swift‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ struct Dream: Equatable {
8383
// Uppercase just the first character in the case name.
8484
let secondIndex = caseName.index(after: caseName.startIndex)
8585

86-
let filePrefix = caseName.substring(to: secondIndex).uppercased() + caseName.substring(from: secondIndex)
87-
86+
let filePrefix = caseName.prefix(upTo: secondIndex).capitalized + caseName.suffix(from: secondIndex)
8887
return filePrefix + "Particle"
8988
}
9089

‎LucidDreams/DreamDetailViewController.swift‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ class DreamDetailViewController: UICollectionViewController, UICollectionViewDel
105105
var indexPathsToDeselect = [IndexPath]()
106106

107107
if let (fromCreature, _) = diff.creatureChange {
108-
let indexOfOld = Dream.Creature.all.index(of: fromCreature)!
108+
let indexOfOld = Dream.Creature.all.firstIndex(of: fromCreature)!
109109
let indexPathOfOld = IndexPath(row: indexOfOld, section: Section.creature.rawValue)
110110
indexPathsToDeselect.append(indexPathOfOld)
111111
}
112112

113113
indexPathsToDeselect += diff.removedEffects.map { removedEffect in
114-
let index = Dream.Effect.all.index(of: removedEffect)!
114+
let index = Dream.Effect.all.firstIndex(of: removedEffect)!
115115
return IndexPath(row: index, section: Section.effect.rawValue)
116116
}
117117

@@ -138,10 +138,10 @@ class DreamDetailViewController: UICollectionViewController, UICollectionViewDel
138138
collectionView?.register(DreamPreviewHeaderReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: DreamPreviewHeaderReusableView.reuseIdentifier)
139139

140140
// Set up initially selected cells.
141-
let selectedCreatureIndex = Dream.Creature.all.index(of: self.dream.creature)!
141+
let selectedCreatureIndex = Dream.Creature.all.firstIndex(of: self.dream.creature)!
142142
let selectedCreatureIndexPath = IndexPath(row: selectedCreatureIndex, section: Section.creature.rawValue)
143143

144-
let selectedEffectIndexPaths = Dream.Effect.all.enumerated().flatMap { idx, effect -> IndexPath? in
144+
let selectedEffectIndexPaths = Dream.Effect.all.enumerated().compactMap { idx, effect -> IndexPath? in
145145
if dream.effects.contains(effect) {
146146
return IndexPath(row: idx, section: Section.effect.rawValue)
147147
}

‎LucidDreams/DreamListViewController.swift‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class DreamListViewController: UITableViewController {
149149
end of this method.
150150
*/
151151
let editing: Bool
152-
let rightBarItem: (UIBarButtonSystemItem, enabled: Bool)?
152+
let rightBarItem: (UIBarButtonItem.SystemItem, enabled: Bool)?
153153

154154
/*
155155
A subset of the bar buttons that we can have as a bar button item in
@@ -338,7 +338,7 @@ class DreamListViewController: UITableViewController {
338338

339339
func configureCreatureCell(_ cell: CreatureCell, at indexPath: IndexPath) {
340340
let creature = model.favoriteCreature
341-
let selectionStyle: UITableViewCellSelectionStyle
341+
let selectionStyle: UITableViewCell.SelectionStyle
342342
if case .viewing = state {
343343
selectionStyle = .default
344344
}
@@ -352,7 +352,7 @@ class DreamListViewController: UITableViewController {
352352
}
353353

354354
func configureDreamCell(_ cell: DreamCell, at indexPath: IndexPath) {
355-
let accessoryType: UITableViewCellAccessoryType
355+
let accessoryType: UITableViewCell.AccessoryType
356356
switch state {
357357
case .duplicating:
358358
accessoryType = .none
@@ -521,8 +521,8 @@ class DreamListViewController: UITableViewController {
521521

522522
let activityViewController = UIActivityViewController(activityItems: images, applicationActivities: [])
523523

524-
activityViewController.completionWithItemsHandler = { _ in
525-
completion()
524+
activityViewController.completionWithItemsHandler = { _, _, _, _ in
525+
completion()
526526
}
527527

528528
strongSelf.present(activityViewController, animated: true, completion: nil)

‎LucidDreams/DreamListViewControllerModel.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ struct DreamListViewControllerModel: Equatable {
112112
} else if dreams.count - 1 == other.dreams.count {
113113
dreamChange = .removed(dreams.last!)
114114
} else if dreams.count == other.dreams.count {
115-
let updatedIndexes: [Int] = dreams.enumerated().flatMap { idx, dream in
115+
let updatedIndexes: [Int] = dreams.enumerated().compactMap { idx, dream in
116116
if dream != other.dreams[idx] {
117117
return idx
118118
}

‎LucidDreams/RangeReplaceableCollection+IndexSet.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import Foundation
1212

13-
extension RangeReplaceableCollection where Index == Int, IndexDistance == Int {
13+
extension RangeReplaceableCollection where Index == Int /* , IndexDistance == Int*/ {
1414
/// Returns a collection with elements in `indexes`.
1515
subscript(indexes: IndexSet) -> Self {
1616
var new = Self()

‎LucidDreams/SKNode+Layout.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import SpriteKit
1212
extension SKNode: Layout {
1313
typealias Content = SKNode
1414

15-
func layout(in rect: CGRect) {
15+
@objcfunc layout(in rect: CGRect) {
1616
// `SKNode` has a flipped coordinate system, so invert our Y coordinates.
1717
let height = parent?.frame.size.height ?? 0
1818
position = CGPoint(x: rect.midX, y: height - rect.midY)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /